Created
February 24, 2017 05:44
-
-
Save DougGregor/2523309bb1ec799f6c745995ba23a6d8 to your computer and use it in GitHub Desktop.
False recursion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol P { | |
associatedtype PType | |
} | |
public protocol Q { | |
associatedtype QType: R | |
} | |
public protocol R { | |
associatedtype RType | |
} | |
func f<T: P>(_: T) where T.PType.RType: Q, T.PType.RType.QType == T.PType {} | |
// We get this signature: <T where T : P, T.PType : R, T.PType == T.PType.RType.QType, T.PType.RType : Q> | |
// But we should get this signature: <T where T : P, T.PType == T.PType.RType.QType, T.PType.RType : Q> | |
// The “T.PType: R” requirement is redundant, but pops up when building the canonical generic environment due to the recursion-breaking code being wrong. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment