Closed
Description
here's the input code:
~/dotty % cat S.scala
trait T { def foo: Int = 3 }
trait T1 extends T { override def foo = super.foo }
trait T2 extends T { override def foo = super.foo }
object C extends T2 with T1 {
def main(args: Array[String]) = ()
}
with Scala 2.11.7, no error:
~/dotty % /usr/local/scala-2.11.7/bin/scalac S.scala
~/dotty % java -classpath . C
but with Dotty:
~/dotty % rm *.class
~/dotty % bin/dotc S.scala
~/dotty % java -classpath . C
Exception in thread "main" java.lang.ClassFormatError: Duplicate method name&signature in class file C$
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
...
the problem is that the generated code has two identical methods named super$foo
:
~/dotty % cfr-decompiler C\$.class
...
public final class C$
implements T,
T2,
T1 {
...
@Override
public /* synthetic */ int super$foo() {
return super.foo();
}
@Override
public /* synthetic */ int super$foo() {
return super.foo();
}
...
}