Separate pattern types from expression types (#5360)

This is a step toward treating patterns as compile-time constants, so
that we can import them more easily.
This commit is contained in:
Geoff Romer
2025-04-28 16:54:37 +00:00
committed by GitHub
parent 84384cf126
commit fafb655d39
565 changed files with 11956 additions and 8095 deletions
+3 -2
View File
@@ -72,12 +72,13 @@ auto HandleParseNode(Context& context, Parse::ReturnTypeId node_id) -> bool {
FullPatternStack::Kind::ExplicitParamList);
}
auto pattern_type_id = GetPatternType(context, as_type.type_id);
auto return_slot_pattern_id = AddPatternInst<SemIR::ReturnSlotPattern>(
context, node_id,
{.type_id = as_type.type_id, .type_inst_id = as_type.inst_id});
{.type_id = pattern_type_id, .type_inst_id = as_type.inst_id});
auto param_pattern_id = AddPatternInst<SemIR::OutParamPattern>(
context, node_id,
{.type_id = as_type.type_id,
{.type_id = pattern_type_id,
.subpattern_id = return_slot_pattern_id,
.index = SemIR::CallParamIndex::None});
context.node_stack().Push(node_id, param_pattern_id);