mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Clean up handling of Call params (#5061)
- Explicitly document that `*Param` and `*ParamPattern` insts represent `Call` parameters. - Stop wrapping compile-time parameter patterns in `ValueParamPattern` insts (because they aren't `Call` parameters). - Document how `MatchContext::results_` relates to the `Call` parameters, and be more consistent about when it's written to. - Remove `RuntimeParamIndex::Unknown`: we no longer need to distinguish "this `Param`'s runtime index is unknown" from "this `Param` isn't a runtime param", because we no longer use `Param`s at all in the latter case. - Rename `RuntimeParamIndex` to `CallParamIndex`. As a side effect of removing the `ValueParamPattern` insts, this fixes a minor diagnostic bug where `NoteInitializingParam` didn't identify the specific parameter that led to a deduction failure, because it expects generic parameters to only be represented by `SymbolicBindingPattern`s, but before this change they could be wrapped in `ValueParamPattern`s.
This commit is contained in:
@@ -228,22 +228,23 @@ static auto PopImplIntroducerAndParamsAsNameComponent(
|
||||
Parse::Tree::PostorderIterator last_param_iter(end_of_decl_node_id);
|
||||
--last_param_iter;
|
||||
|
||||
return {
|
||||
.name_loc_id = Parse::NodeId::None,
|
||||
.name_id = SemIR::NameId::None,
|
||||
.first_param_node_id = first_param_node_id,
|
||||
.last_param_node_id = *last_param_iter,
|
||||
.implicit_params_loc_id = implicit_params_loc_id,
|
||||
.implicit_param_patterns_id =
|
||||
implicit_param_patterns_id.value_or(SemIR::InstBlockId::None),
|
||||
.params_loc_id = Parse::NodeId::None,
|
||||
.param_patterns_id = SemIR::InstBlockId::None,
|
||||
.call_params_id = SemIR::InstBlockId::None,
|
||||
.return_slot_pattern_id = SemIR::InstId::None,
|
||||
.pattern_block_id = implicit_param_patterns_id
|
||||
? context.pattern_block_stack().Pop()
|
||||
: SemIR::InstBlockId::None,
|
||||
};
|
||||
auto pattern_block_id = SemIR::InstBlockId::None;
|
||||
if (implicit_param_patterns_id) {
|
||||
pattern_block_id = context.pattern_block_stack().Pop();
|
||||
context.full_pattern_stack().PopFullPattern();
|
||||
}
|
||||
return {.name_loc_id = Parse::NodeId::None,
|
||||
.name_id = SemIR::NameId::None,
|
||||
.first_param_node_id = first_param_node_id,
|
||||
.last_param_node_id = *last_param_iter,
|
||||
.implicit_params_loc_id = implicit_params_loc_id,
|
||||
.implicit_param_patterns_id =
|
||||
implicit_param_patterns_id.value_or(SemIR::InstBlockId::None),
|
||||
.params_loc_id = Parse::NodeId::None,
|
||||
.param_patterns_id = SemIR::InstBlockId::None,
|
||||
.call_params_id = SemIR::InstBlockId::None,
|
||||
.return_slot_pattern_id = SemIR::InstId::None,
|
||||
.pattern_block_id = pattern_block_id};
|
||||
}
|
||||
|
||||
static auto MergeImplRedecl(Context& context, SemIR::Impl& new_impl,
|
||||
|
||||
Reference in New Issue
Block a user