Divergence from Scala 2 specification in case class desugaring #16309
julienrf
started this conversation in
General Discussion
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’ve noticed that the following code snippet does not compile in Scala 2, but does compile in Scala 3:
The reason is that in Scala 2, the compiler does not synthesize a method
copy
because there is already a method of that name that is defined by the user.However, in Scala 3 the compiler does synthesize an overload of
copy
that works alongside the one defined by the user.In the Scala 2 specification, it says that only the name is significant: https://scala-lang.org/files/archive/spec/2.13/05-classes-and-objects.html#case-classes
Is this difference from Scala 2 expected?
Beta Was this translation helpful? Give feedback.
All reactions