Since Xcode 7 and Swift 2.0, I get the error above, like in the screenshot shown here:
Ok, in my case it was because I had an enum nested in a generic class. Now, the strange thing, is that when I isolated the problem (into the BaseDao2), the compiler told me the right error, but in my real BaseDao implementation (which has more stuff), it throw "trap 6".
Type 'DaoError2' nested in generic type 'BaseDao2' is not allowed
When I had this:
class BaseDao2: InjectRestSession{
enum DaoError2: ErrorType{
case FAILED_RESPONSE(String)
case INVALID_RESULT(String)
case FAIL_TO_LIST, FAIL_TO_GET
}
func get() -> T?{
return nil
}
}
Anyway, in my case, I move the DaoError out of the BaseDao and everything compiled. Anyway, my feeling is that "trap 6" is what something cannot compile and the compiler got confused. Starting from a simple case, and adding back what you think might be causing the problem can be helpul to identify the problem by getting the right compile error. In other word, you have to be gentle with the swift compiler.