forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit 8f067e0
committed
Do not bring forward symbols created in transform and backend phases (scala#21865)
In the i21844 issue minimization, first the `Macro.scala` and
`SuperClassWIthLazyVal.scala` compilation units are compiled, then in
the next run `SubClass.scala` is compiled. While compiling
`SuperClassWIthLazyVal.scala`, in the `LazyVals` transform phase, the
lzyINIT initialization fields are created. In the next run, while
compiling `SubClass.scala`, in the `GenBCode` phase, the compiler would
try to access the lzyINIT symbol, leading to a stale symbols crash.
While that symbol was a part of the SuperClass, it by design is not
generated for the Subclass - if we were to completely split those files
into 2 separate compilations, that symbol would be created only for the
classfile, but it would not be included in tasty, so the second
compilation would not try to access it.
This observation inspires the proposed fix, where if the symbol was
first created in or after the first transform phase (so after the
pickler phases), we do not try to bring forward this denotation, instead
returning NoDenotation.
In this PR, we also remove the fix proposed in i21559, as it is no
longer necessary with the newly added condition. There, since one of the
problematic Symbols created in `LazyVals` was moved elsewhere in
`MoveStatics`, we checked if that symbol could be found in a companion
object. I was not able to create any reproduction where a user defined
static would produce this problem, so I believe it’s safe to remove
that.
[Cherry-picked 7d9771d][modified]1 parent c9e4b03 commit 8f067e0Copy full SHA for 8f067e0
File tree
0 file changed
+0
-0
lines changedFilter options
0 file changed
+0
-0
lines changed
0 commit comments