-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Derive Equatable & Hashable for uninhabited types #17756
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
Derive Equatable & Hashable for uninhabited types #17756
Conversation
@mdiep Given that it's specifically called out in the original proposal I think it would make sense to ping the Evolution Discussion and ask for guidance. If this does get merged with should amend the original proposal in some fashion to indicate the change. |
Since we don't have special treatment for |
Right. This might change the implementation of SE-0215, but is a separate question.
I've started a discussion. |
8f545d9
to
d61f240
Compare
To briefly repeat what I said in my reply on the forum, I'm in support this. The limitation was arbitrary in retrospect because it seemed "natural", but the generic use cases shown in the discussion thread are convincing. Thanks, Matt! |
The discussion has received positive feedback from core members and no negative feedback. I think that means this can proceed? |
@swift-ci Please smoke test |
bump |
There's a conflict now, so you'll have to fix that before we can merge. |
d61f240
to
30949c7
Compare
Sorry, I didn't see that on my phone. 🙈 I've rebased and fixed the conflicts. |
@swift-ci Please smoke test |
bump |
I'd like to get this in 4.2 if possible. Should I just cherry-pick and open a PR against the 4.2 branch? |
Yep, then include all the information in https://swift.org/blog/4-2-release-process/#pull-requests-for-release-branch and assign it to Ted. |
The original proposal did explicitly say this wouldn't be done:
But I'm hoping that this change doesn't need to go through the evolution process:
This is clearly possible
It's useful when your enum is part of a larger protocol, you expect it to gain cases, or you're using it with generics.
I've been running into this a lot at work. It's often confusing for people to figure out why these aren't derived and what they should do about it.