Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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()
}
@protocool

This comment has been minimized.

Copy link
Owner Author

@protocool protocool commented Jul 29, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.