You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is annoying. It's a breaking change compared to Scala 2. But fixing it would be a breaking change wrt. Scala 3... There isn't a clear-cut answer here. It goes against the spec on the one hand. But on the other hand, it's consistent with what happens for case classes, for which the structural equality notion is at least as important as for value classes.
In today's Core Meeting, it was decided that the semantic introduced in Scala 3 will remain as is. This decision is aligned with the decision for #22494, where allowing this and forbidding the other will create a workaround to defining custom equals and hashCode methods.
I will leave this ticket open for now until we change the specification.
Compiler version
590691b
Minimized code
Output
Scala 3
Scala 2
Expectation
As the specification; SIP-15, explains, Value Classes are implicitly assumed to have structural equality and hash codes.
Notes
Same problem with the
hashCode
method.The text was updated successfully, but these errors were encountered: