-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated Bad diagnostic errors #65531
Conversation
Co-authored-by: Luciano Almeida <[email protected]>
Hey @LucianoPAlmeida I have committed the new changes you suggested, please have a look |
Sorry, been a bit busy lately with work so I just glanced on the basics when commenting. struct SS<T> : T { } // expected-error{{cannot inherit from non-protocol type 'T'}} It is still not clear what cannot inherit from not protocol types. So you can start thinking about the rules about inheritance for struct types and how to describe that in a succinct, but clear way. Same applies to other cases, so you can start with questions such as: |
@@ -3056,7 +3056,7 @@ ERROR(duplicate_inheritance,none, | |||
WARNING(duplicate_anyobject_class_inheritance,none, | |||
"redundant inheritance from 'AnyObject' and Swift 3 'class' keyword", ()) | |||
ERROR(inheritance_from_protocol_with_superclass,none, | |||
"inheritance from class-constrained protocol composition type %0", (Type)) | |||
"cannot inherit from class-constrained protocol composition type %0", (Type)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to split this into multiple diagnostics and change phrasing. There are a couple of issues here which are not clearly stated by the diagnostic:
- There are only curtain types allowed in inheritance clause, this could be fixed by splitting diagnostic into multiple ones;
- Inheritance in extension is even more restricted to protocols only;
- Message is not very clear about the why to give actionable guidance to the developer how to fix the problem;
- I think it might be useful to separate type kind + name information into a note and give error more information about what is going on here;
Fixes #64903
I have updated the error messages which were not very clear to the user.
Environment
Swift version 5.9-dev (LLVM 6a04c4848990c70, Swift f2bac1a22939a4d)
This is my first pull request on this project. Please scold me if I have made any mistake.