Created
July 29, 2015 17:03
-
-
Save protocool/ecbd9016bf37c5b6f080 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import Foundation | |
protocol P { | |
typealias PT: NSObject = Self | |
static func vendSpecific() -> PT? | |
} | |
extension P where Self: NSObject, PT == Self { | |
static func vendSpecific() -> PT? { | |
return nil | |
} | |
} | |
class A: NSObject, P { | |
} | |
class B: A { | |
typealias PT = B | |
} | |
func compilerSIGILL() { | |
B.vendSpecific() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Without the typealias in Class B, you can't call B.vendSpecific() b/c B doesn't conform to the P extension's constraints.
With the typealias, the compiler SIGILLs because SIL verification failed.