原始类型"错误"无法通过任何文字表达

And*_*ang 1 swift swift3

这段代码不再在Swift 3中运行.任何想法?

码:

public enum ErrorResponse : Error {
    case Error(Int, Data?, Error)
}
Run Code Online (Sandbox Code Playgroud)

错误:

/Swaggers/Models.swift:13:29: Raw type 'Error' is not expressible by any literal
Run Code Online (Sandbox Code Playgroud)

Rob*_*ier 6

您没有提供足够的代码来重现问题(编译时编译得很好).但是,该ErrorType协议Error在Swift 3中被重命名.您可能Error在系统中的某个地方调用了某种类型,这会引起混淆.解决方案是明确Error您的意思是:

public enum ErrorResponse : Swift.Error {
Run Code Online (Sandbox Code Playgroud)