Description
We get a duplicate generated symbol for fromIterableWithSameElemType
in class ArrOps
when compiling iarray.scala:
import scala.reflect.ClassTag
class Arr[T](private val underlying: scala.Array[T]) extends AnyVal
trait SeqMonoTransforms[+A, +Repr] extends Any {
protected[this] def fromIterableWithSameElemType(): Repr
}
class ArrOps[A](val xs: Arr[A]) extends AnyRef with SeqMonoTransforms[A, Arr[A]] {
def fromIterableWithSameElemType(): Arr[A] = xs
}
object Test {
def main(args: Array[String]) =
println(new ArrOps(new Arr(Array(1, 2, 3))).fromIterableWithSameElemType)
}
If we compile this with -Ycheck:erasure, we get:
exception occurred while compiling iarray.scala
Exception in thread "main" class dotty.tools.dotc.reporting.diagnostic.messages$Error at iarray.scala:9: method fromIterableWithSameElemType is already defined as method fromIterableWithSameElemType: ()ErasedValueType(Arr, Object)
(the definitions have matching type signatures)
at dotty.tools.dotc.reporting.Reporting$class.error(Reporter.scala:85)
at dotty.tools.dotc.core.Contexts$Context.error(Contexts.scala:57)
at dotty.tools.dotc.typer.Checking$$anonfun$checkDecl$1$1.doubleDefError$1(Checking.scala:548)
at dotty.tools.dotc.typer.Checking$$anonfun$checkDecl$1$1.apply(Checking.scala:551)
at dotty.tools.dotc.typer.Checking$$anonfun$checkDecl$1$1.apply(Checking.scala:540)
at scala.collection.immutable.List.foreach(List.scala:381)