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
The problem is that the trait setter A$_setter_$A$$$qmark_$eq has a mangled name but the field A$$? is unmangled. As a consequence, the memoization code in line 171 falls into this case.
valfield= sym.field
if!field.exists then// When transforming the getter, we determined that no field was needed.// In that case we can keep the setter as is, with a () rhs.
tree
We should preferably use an unmangled name for the trait setter. If that does not work we have to take mangling into account when computing field.
…ameSeparated.
This brings the `case name @ AnyQualfiedName(_, _)` in line with
the behavior of `case naem: SimpleName`, which already did not
mangle before this change.
This fixesscala#14667 because `Mixin.traitSetterName` indirectly calls
`fullNameSeparated`, and expanded private symbolic member names
would get mangled, and therefore could not identify their
corresponding fields anymore.
Compiler version
Affects
3.0.0
to3.1.2-RC1
.Does not affect
2.13.8
.Minimized code
Link to 3.1.1 Scastie
Output
Expectation
This program should print an empty line, not
null
.Observations: the problem does not occur when
?
is renamed to an alphanumeric identifier (!)?
is a definition instead of a valueA
is a class instead of a trait?
is protected or publicThe
?
can be replaced with any other symbol e.g.*
,|||
, ... (all of those will trigger the same problem)When replacing
""
by e.g.1
, the program prints0
which confirms that it is a problem related to initialization.The text was updated successfully, but these errors were encountered: