[SR-15077] Better error messages for enum cases as protocol witnesses #57403
Labels
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
improvement
Additional Detail from JIRA
md5: 99cf7e150879e216868128a0f9c3e048
Issue Description:
Enum cases can conform to protocol static func requirements. However, when the static func involves closures, the error messages produced by the compiler can seem confusing. Take this case:
For this, the compiler will show an error on `enum MyEnum` as seen above. If you apply Xcode's "fix it", you would get the following code generated, which leads to another error:
However, the reason that `MyEnum` did not conform to `MyProtocol` was because the closure was not marked `@escaping` in the protocol requirements. Perhaps, the error message for this instance can be improved to notify the programmer of this condition.
The text was updated successfully, but these errors were encountered: