You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[AST|ASTWalker] Fix assertion hit walking an invalid AST with a protocol decl inside an extension
The AST walker calling getGenericParams on a protocol decl would eventually
call computeNominalType. computeNominalType checks that the protocol (as a
nomimnal type decl) appears within a type context, and if so, asks for the
SelfNominalTypeDecl of that context. If the context is an extension, that
ends up asking for its extended nominal, which is a problem if we're walking
a pre-typechecked AST – we hit the assertion "Extension must have already been
bound (by bindExtensions)").
Unlike other nominal types, it's not valid Swift for protocols to appear within
type contexts, so exclude protocol decls from taking this code path. This
results in us providing Type() as the parent type of the produced NominalType,
just like we do for protocols inside functions or other invalid contexts.
Resolves <rdar://problem/58549036>
0 commit comments