mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 10:21:04 +01:00
Basic support for parameterized interfaces. (#1220)
To make this work, introduce impl bindings into scope immediately when type-checking. We may rely on their existence before we finish type-checking the enclosing pattern.
This commit is contained in:
@@ -303,6 +303,9 @@ static auto ResolveNames(Declaration& declaration, StaticScope& enclosing_scope)
|
||||
auto& iface = cast<InterfaceDeclaration>(declaration);
|
||||
StaticScope iface_scope;
|
||||
iface_scope.AddParent(&enclosing_scope);
|
||||
if (iface.params().has_value()) {
|
||||
RETURN_IF_ERROR(ResolveNames(**iface.params(), iface_scope));
|
||||
}
|
||||
RETURN_IF_ERROR(iface_scope.Add("Self", iface.self()));
|
||||
for (Nonnull<Declaration*> member : iface.members()) {
|
||||
RETURN_IF_ERROR(AddExposedNames(*member, iface_scope));
|
||||
|
||||
Reference in New Issue
Block a user