Closed
Description
minimized code
compile with dotc 19.0-RC1
trait Foo { def foo: String = "foo" }
compile with scalacenter/scala@a8f11ef
object TestFoo {
def main(args: Array[String]): Unit = {
assert(new Foo {}.foo == "foo")
}
}
runtime error:
Exception in thread "main" java.lang.NoSuchMethodError: Foo.foo$(LFoo;)Ljava/lang/String;
at TestFoo$$anon$1.foo(TestFoo.scala:5)
at TestFoo$.main(TestFoo.scala:5)
at TestFoo.main(TestFoo.scala)
...
expectation
Anonymous subclasses of traits generated by Scala 2.13.x implement methods by calling a static forwarder on the generated Interface.