[SR-13372] Confusing error messages about property protocol conformance #55812
Labels
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
improvement
type checker
Area → compiler: Semantic analysis
Additional Detail from JIRA
md5: eabb02acaadfb1fdb1dfefdc615deae8
Issue Description:
(Using Swift 5.2.4 under Xcode 11.6)
The following code tries to enforce a behaviour on the
child
property of theParent
type:As everything above compiles cleanly, I didn't expect the following error:
After some trial-and-error I understood that
IdentifiableChild
should be instead declared in one of the following ways:…or…
However, the compiler error didn't really give me any hints about what was wrong in the first example code, especially given that the original
IdentifiableChild
definition was accepted without errors or warnings.The obvious improvement proposal is to rewrite the error message to give the programmer a clearer understanding of the situation and (hopefully) offer a “Fix” action. Moreover, I'd like to ask: Why doesn't the original definition of
IdentifiableChild
work, and (since it was accepted by the compiler) what is its usefulness?The text was updated successfully, but these errors were encountered: