bug
bug copied to clipboard
Illegal duplicate inheritance error not issued for ProductN (and other potential case class parents)
I noticed this loophole when perusing fixDuplicateSyntheticParents in Typers.
scala> trait T[A]
defined trait T
scala> abstract class C(i: Int) extends T[Int] with T[String]
<console>:8: error: illegal inheritance;
self-type C does not conform to T[Int]'s selftype T[Int]
abstract class C(i: Int) extends T[Int] with T[String]
^
<console>:8: error: illegal inheritance;
self-type C does not conform to T[String]'s selftype T[String]
abstract class C(i: Int) extends T[Int] with T[String]
^
scala> abstract class C(i: Int) extends Product1[Int] with Product1[String]
defined class C
We should easily be able to:
- limit that code to case classes
- remove
ProductNfrom the list of potentially synthetic parents (as it is no longer even experimentally a case class parent)
Imported From: https://issues.scala-lang.org/browse/SI-9187?orig=1 Reporter: @retronym Affected Versions: 2.11.5
Is it still reproducible on 2.13.8?
Is it still reproducible on 2.13.8?
Yes it is
@dwijnand you've been in this area on the Scala 3 side lately. is there anything we should crosslink?
No, this just looks like a bug in the Scala 2 check.