Skip to content

Commit e4e6332

Browse files
authored
Check explicit params exist. (#4875)
If there are no explicit params, then `last_param_node_id` should be `implicit_params_loc_id`. But there is no use case currently, so for now we assume explicit params exist and assert if not, so this can be found and updated then.
1 parent b0b1554 commit e4e6332

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

toolchain/check/name_component.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ auto PopNameComponent(Context& context, SemIR::InstId return_slot_pattern_id)
3636
context.node_stack()
3737
.PopForSoloNodeId<Parse::NodeKind::ImplicitParamListStart>();
3838
// Only use the end of implicit params if there weren't explicit params.
39-
if (last_param_node_id.has_value()) {
40-
last_param_node_id = params_loc_id;
41-
}
39+
CARBON_CHECK(last_param_node_id.has_value(),
40+
"Implicit parameters currently only occur before explicit "
41+
"parameters, update and test when this changes");
4242
} else {
4343
implicit_param_patterns_id = SemIR::InstBlockId::None;
4444
}

0 commit comments

Comments
 (0)