mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-19 09:00:27 +00: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:
1 parent
07bad72d86
commit
a0973f4f47
4 files changed
+203
-44
No files matched your search
@@ -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