Closed
Description
Compiler version
3.1.0
Minimized code
trait Foo(val num: Int) // a trait with a parameter stored in a val
class Bar(num: Int) extends Foo(num): // an extending class with a parameter of the same name
def bar = this.num // implicitly creates another num in Bar
Bar(123)
Output
Compiles, but the program crashes when run:
java.lang.ClassFormatError: Duplicate field name "num" with signature "I"
Expectation
I would expect the code to compile, not crash, and produce a Bar
object just like it does if Foo
is a class rather than a trait.