Continue with case class synthetic method generation when abstract method declaration is present

I’d like to call a synthetic method of the case class in a trait that many case classes will extend like copy in

trait MapI[C] {
  def i: Int
  def s: String
  def copy(i: Int = this.i, s: String = this.s): C
  def mapI(i: Int): C = copy(i)

case class C(i: Int, s: String) extends MapI[C]

The 2.13.8 compiler stops me from doing so by "class C needs to be abstract. Missing implementation for: def copy(i: Int, s: String): C inherited from trait MapI" while Scala 3.1.2 works fine.

It would be great not to stop synthetic method generation in Scala 2 either if an abstract method declaration is present. This way one would not need to implemented mapI in every case class.

Thanks for considering!

1 Like

Edit: as noted above it works in Scala 3 already :slight_smile:


Hi, I’m not sure what you mean. I asked for Scala 2 support because the code base I’m working on is still Scala 2.

So that the scala 2 maintainers can keep track you can open an issue on GitHub here:

I did so :slightly_smiling_face: