-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Enumeration should derive CanEqual
#13722
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
Comments
If it's not an actual bug, then it's at least missing proper documentation under the enum/equality section. |
I noticed that the strictEquality tests explicitly derive |
note that case classes and case objects also do not derive CanEqual by default |
True, but I'm with @soronpo here: I believe any reasonable programmer would expect this to just work, and I'm having trouble coming up with a reasonable argument why one would ever not want this to be true. IMO, this one's a design bug, and should be tweaked. |
they did before |
I started a thread on contributors. |
Paraphrasing @smarter It would potentially be problematic if you define custom equals for your enum, and then that case should probably not derive CanEqual |
IMO, if you define an |
Right -- |
Somewhat related enums whose cases are singletons should also derive Ordering with this implementation: given Ordering[T] = Ordering.by(_.ordinal) Alternatively add the above code to the |
When using an enumeration, we expect pattern matching on the objects to work by default even under
strictEquality
.Compiler version
v3.1.0-RC1
Minimized code
Output
Expectation
No error.
The text was updated successfully, but these errors were encountered: