Closed soronpo closed 1 year ago
Hello,
I encounter the same symptom:
dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method definition$lzyINIT2#52624 in class Generator, defined in Period(76..93, run = 2), is referred to in run Period(92..92, run = 3)
Code is difficult to minimize, however metaprogramming or quotes do not seem to be involved.
The faulty symbol definition$lzyINIT2#52624
is associated to a declaration
object definition extends Definition:
...
Changing the line for the declaration below acts as a work-around.
val definition = new Definition:
...
Running the sbt build a second time succeeds after the crash.
sbt:> clean
sbt:> compile /// Crashes
sbt:> compile /// with no source change. NO CRASH. (and correct behavior!)
Hope this helps.
Still seeing this on 3.4.2
My repro is very complicated involving macros unfortunately, but I am seeing the same symptoms as https://github.com/scala/scala3/issues/17294#issuecomment-1523257480: it happens with a top level object and goes away when either making it a top level val or on the second compile.
Could be related somehow to #17152, but this also occurs for older compiler versions and this minimization is far simpler. It may be that this should just yield a cyclic dependency error instead of a crash. I'm not sure what the cross-file macro dependency limitations are.
Compiler version
v3.2.2 Also tested on the latest nightly: scala-3.3.1-RC1-bin-20230416-2f4cc4c-NIGHTLY
Minimized code
DFVal.scala
Width.scala
Output (click arrow to expand)