-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Typechecker] Emit specialized diagnostic notes on automatic synthesis failure to Comparable #32797
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
Conversation
@swift-ci please smoke test |
test/decl/protocol/special/comparable/comparable_unsupported_type.swift
Outdated
Show resolved
Hide resolved
test/decl/protocol/special/comparable/comparable_unsupported_type.swift
Outdated
Show resolved
Hide resolved
The last commit is NFC - I did some refactoring as I wanted to reuse some code for the notes and avoid a lot of duplication. There’s a bit more I need to refactor, I think I will probably put this commit and the new one into a separate PR instead. @swift-ci please smoke test |
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.
LGTM! But please revert all of the formatting changes to the unrelated parts of code before merging.
Sorry about that. I am actually gonna create a separate PR for the refactoring, so I am gonna revert that commit for now. @swift-ci please smoke test |
Sounds good! |
@theblixguy Could you do me a favor and wait until #32828 lands? I have moved |
Sure no worries! |
Thank you! |
@theblixguy Localization changes went in so you can rebase and merge this PR, thank you for waiting! |
…s failure to Comparable
@swift-ci please smoke test |
Automatic synthesis of
Comparable
is only supported forenum
s for now. So, if we have astruct
or aclass
and a conformance failure toComparable
, emit a note just like we do forEquatable
(on classes) for example, to let the user know that automatic synthesis is unsupported.As a bonus, also emit a note when the
enum
has a raw type or if the associated values don't conform toComparable
.Resolves SR-13148
rdar://problem/65116465