mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Fix deduction crash for function with missing parameters. (#4461)
This is because `var x:! () = ();` modifies the binding index, which causes `A` to be generic, which causes the params to be used, which crashes. There may be another issue to fix here so that the invalid binding doesn't modify the binding index, but at least `param_patterns_id` should probably be set consistently with `params_id`.
This commit is contained in:
@@ -183,8 +183,10 @@ static auto BuildFunctionDecl(Context& context,
|
||||
|
||||
auto name = PopNameComponent(context, return_slot_pattern_id);
|
||||
if (!name.params_id.is_valid()) {
|
||||
CARBON_CHECK(!name.param_patterns_id.is_valid());
|
||||
context.TODO(node_id, "function with positional parameters");
|
||||
name.params_id = SemIR::InstBlockId::Empty;
|
||||
name.param_patterns_id = SemIR::InstBlockId::Empty;
|
||||
}
|
||||
|
||||
auto name_context = context.decl_name_stack().FinishName(name);
|
||||
|
||||
Reference in New Issue
Block a user