Remove index fields from ParamPatterns (#6815)

This is a step toward removing the index from `InitForm`, so that equal
form values always have equal representations.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Geoff RomerandJon Ross-Perkins authored and GitHub committed 2026-03-03 00:19:47 +00:00
1 parent 9ff6b0a682
commit 6dba8ee111
298 files changed
+1741 -1747

No files matched your search

+6 -9
View File
@@ -280,24 +280,21 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
if (node_kind == Parse::NodeKind::LetBindingPattern ||
node_kind == Parse::NodeKind::FormBindingPattern) {
auto type_id = context.insts().GetAttachedType(result_inst_id);
// Allocate a dummy index to preserve index of subsequent `InitForm`s.
// TODO: Remove this once we remove `InitForm::index`.
context.full_pattern_stack().NextCallParamIndex();
if (is_ref) {
result_inst_id = AddPatternInst<SemIR::RefParamPattern>(
context, node_id,
{.type_id = type_id,
.subpattern_id = result_inst_id,
.index = context.full_pattern_stack().NextCallParamIndex()});
{.type_id = type_id, .subpattern_id = result_inst_id});
} else if (node_kind == Parse::NodeKind::FormBindingPattern) {
result_inst_id = AddPatternInst<SemIR::FormParamPattern>(
context, node_id,
{.type_id = type_id,
.subpattern_id = result_inst_id,
.index = context.full_pattern_stack().NextCallParamIndex()});
{.type_id = type_id, .subpattern_id = result_inst_id});
} else {
result_inst_id = AddPatternInst<SemIR::ValueParamPattern>(
context, node_id,
{.type_id = type_id,
.subpattern_id = result_inst_id,
.index = context.full_pattern_stack().NextCallParamIndex()});
{.type_id = type_id, .subpattern_id = result_inst_id});
}
}
context.node_stack().Push(node_id, result_inst_id);