You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
traitFoo(valnum:Int) // a trait with a parameter stored in a valclassBar(num: Int) extendsFoo(num):// an extending class with a parameter of the same namedefbar=this.num // implicitly creates another num in BarBar(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.
The text was updated successfully, but these errors were encountered:
There needs to be a special alignment of planetary body to obtain two fields
that have different names for Dotty (one has a FieldName, the other a regular name),
but that still map to the same underlying name. This is now detected and resolved.
Fixesscala#13862
There needs to be a special alignment of planetary body to obtain two fields
that have different names for Dotty (one has a FieldName, the other a regular name),
but that still map to the same underlying name. This is now detected and resolved.
Fixesscala#13862
There needs to be a special alignment of planetary body to obtain two fields
that have different names for Dotty (one has a FieldName, the other a regular name),
but that still map to the same underlying name. This is now detected and resolved.
Fixesscala#13862
There needs to be a special alignment of planetary body to obtain two fields
that have different names for Dotty (one has a FieldName, the other a regular name),
but that still map to the same underlying name. This is now detected and resolved.
Fixesscala#13862
Compiler version
3.1.0
Minimized code
Output
Compiles, but the program crashes when run:
Expectation
I would expect the code to compile, not crash, and produce a
Bar
object just like it does ifFoo
is a class rather than a trait.The text was updated successfully, but these errors were encountered: