mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 20:11:12 +01:00
Model type expressions as regions (#4698)
This is a precondition for enabling the new pattern-matching subsystem to support binding patterns that have `if` expressions in the type position. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
95c9634c60
commit
a112cbde5c
@@ -141,12 +141,9 @@ auto MatchContext::EmitPatternMatch(Context& context,
|
||||
case SemIR::BindingPattern::Kind:
|
||||
case SemIR::SymbolicBindingPattern::Kind: {
|
||||
CARBON_CHECK(kind_ == MatchKind::Callee);
|
||||
auto binding_pattern = pattern.inst.As<SemIR::AnyBindingPattern>();
|
||||
auto cache_entry =
|
||||
context.bind_name_cache().Lookup(binding_pattern.entity_name_id);
|
||||
// The cached bind_name should only be used once.
|
||||
auto bind_name_id =
|
||||
std::exchange(cache_entry.value(), SemIR::InstId::Invalid);
|
||||
auto [bind_name_id, type_expr_id] =
|
||||
context.bind_name_map().Lookup(entry.pattern_id).value();
|
||||
context.InsertHere(type_expr_id);
|
||||
auto bind_name = context.insts().GetAs<SemIR::AnyBindName>(bind_name_id);
|
||||
CARBON_CHECK(!bind_name.value_id.is_valid());
|
||||
bind_name.value_id = entry.scrutinee_id;
|
||||
|
||||
Reference in New Issue
Block a user