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
Solution: only use simple name for fields
Before the change, given the following code
class A extends App
The compiler will generate the following setter in the phase Mixin:
scala[Qualified $ App][Qualified $_setter_$ scala$App$$initCode_=]
However, the field created by the getter will be:
scala[Qualified $ App][Qualified $$ initCode][Suffix $$local]
It will cause a problem in the phase Memoize in the line below:
val field = sym.field.orElse(newField).asTerm
The problem is that, for the setter, `sym.field` will be unable to
find the field generated by the getter, due to the name mismatch.
Consequently, the method `newField` will be called to create another
field symbol without corresponding trees.
After the change, the following field is generated instead:
scala$App$$initCode[Suffix $$local]
Now, the setter will be able to find the field via `sym.field`.
This fix avoids generate a phantom symbol without corresponding trees.
0 commit comments