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
Sema: Fix type lookup from protocol extensions with a class-constrained 'Self'
A protocol extension can add additional generic constraints on
'Self' or associated types thereof. In particular, 'Self' itself
can have a superclass constraint placed on it.
There were a couple of problems with this corner case:
- Type aliases defined in protocols that 'Self' conforms to _as a
concrete type_ to were not handled properly, triggering an assertion.
For example,
protocol P { typealias T = ... }
class C : P {}
protocol Q {}
extension Q where Self : C { ... T ... }
The conformance o P comes from the 'Self : C' constraint.
- If the type was found in a superclass of 'Self', we used the wrong
base type for the substitution.
For example,
protocol P {}
class C<T> { typealias A = T }
class D : C<Int> {}
extension P where Self : D { ... A ... }
The substituted type of 'A' should be computed with a self type
of C<Int> here.
Also, take another stab at cleaning up the mess that is
resolveTypeInContext() and related bits of code.
0 commit comments