Reputation: 181
This is really confusing me and I'm tired looking for workaround to make it work, may be anyone else faced this issue?
Welcome to Swift! Type :help for assistance.
1> protocol Type {}
2> class Expression<T: Type> {}
3> var exp: Expression<Type>? = nil
exp: Expression<Type>? = nil
4> class A {
5. var exp: Expression<Type>? = nil
6. }
Segmentation fault: 11
Somehow third line works only in repl, but doesn't work in playground
Upvotes: 0
Views: 579
Reputation: 4676
Xcode 6.1 GM 2 fixed a lot of the compiler crashes.
If you have to rely on an older Xcode version then there is no other way than changing your code's structure until it compiles successfully without crashes.
Upvotes: 0
Reputation: 5851
I have the same issue. I did get it to work.... But at a cost.
You have to make the protocol an objective c protocol by prepending @objc
Try this code:
@objc protocol Type {}
class Expression<T: Type> {}
var exp: Expression<Type>? = nil
class A {
var exp: Expression<Type>? = nil
}
Upvotes: 2