Skip to content
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

case class synthetic method generation when abstract method declaration is present #12623

Closed
peter-empen opened this issue Jul 23, 2022 · 1 comment · Fixed by scala/scala#10085
Assignees
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) has PR
Milestone

Comments

@peter-empen
Copy link

Reproduction steps

Scala version: 2.13.8

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]

Problem

The compiler reports "class C needs to be abstract. Missing implementation for: def copy(i: Int, s: String): C inherited from trait MapI".

Expectation

I'd appreciate the compiler not stopping synthetic method generation if an abstract method declaration is present. This way one would not need to implement mapI in every case class. I also checked Scala 3.1.2 which works fine.

See also

https://contributors.scala-lang.org/t/continue-with-case-class-synthetic-method-generation-when-abstract-method-declaration-is-present/5826

@SethTisue SethTisue added the fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) label Aug 25, 2022
@SethTisue SethTisue added this to the Backlog milestone Aug 25, 2022
@som-snytt
Copy link

A "has PR" label is strictly redundant with Github's tag "May be fixed by".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) has PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants