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: Explicitly encode that only protocol and extension members are visible in a 'where' clause
Today, ASTScope only creates NominalTypeWhereScopes for the 'where'
clause of an extension or a protocol. All other generic declarations
model the 'where' clause as part of the declaration's scope itself
(but it's not part of the body scope).
Lookups into the NominalTypeWhereScope would look inside the type,
because this is how we want protocol and protocol extension scopes
to work -- you should be able to refer to associated types without
a 'Self' prefix.
Let's add a conditional check for protocols and extensions to the
implementation of NominalTypeWhereScope, so that we can use this
scope for all other 'where' clauses and keep the old behavior.
Note that today, even _concrete_ extensions have this behavior,
which is perhaps slightly unexpected:
class C<T> {
typealias U = Int
}
extension C where T == U {}
It would be nice to tighten up the rule here but there's already a
test in the suite that depends on it.
0 commit comments