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:
Richard Smith
2022-04-29 12:42:15 -07:00
committed by GitHub
parent b9538129a2
commit 3b58a1bf48
15 changed files with 513 additions and 197 deletions
@@ -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));