mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 08:51:04 +01:00
When reentering an interface scope, reintroduce the Self parameter. (#4162)
This is not easy to test right now, because it should only really be visible through `default fn` declarations, which we don't support properly yet.
This commit is contained in:
@@ -213,6 +213,15 @@ static auto PushNameQualifierScope(Context& context,
|
||||
|
||||
context.scope_stack().Push(scope_inst_id, scope_id, instance_id, has_error);
|
||||
|
||||
// An interface also introduces its 'Self' parameter into scope, despite it
|
||||
// not being redeclared as part of the qualifier.
|
||||
if (auto interface_decl =
|
||||
context.insts().TryGetAs<SemIR::InterfaceDecl>(scope_inst_id)) {
|
||||
auto& interface = context.interfaces().Get(interface_decl->interface_id);
|
||||
context.scope_stack().AddCompileTimeBinding();
|
||||
context.scope_stack().PushCompileTimeBinding(interface.self_param_id);
|
||||
}
|
||||
|
||||
// Enter a parameter scope in case the qualified name itself has parameters.
|
||||
context.scope_stack().Push();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user