Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: crash of JVM backend in kuceramartin/tyqu #18179

Closed
WojciechMazur opened this issue Jul 10, 2023 · 15 comments
Closed

Regression: crash of JVM backend in kuceramartin/tyqu #18179

WojciechMazur opened this issue Jul 10, 2023 · 15 comments
Labels
area:backend itype:bug itype:crash regression This worked in a previous version but doesn't anymore stat:needs bisection Need to use nightly builds and git bisect to find out the commit where this issue was introduced

Comments

@WojciechMazur
Copy link
Contributor

Compiler version

Fails in 3.3.0 (stacktrace below)
Fails in 3.3.2-RC1-bin-20230707-7ede150-NIGHTLY with different error message
Works in 3.2.2

Minimized code

Not yet minimized, based on compilation of OSS project: https://github.com/kuceramartin/tyqu.git

Output (click arrow to expand)

dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method columnsWithNames$lzyINIT1#52597 in class Table, defined in Period(77..94, run = 2), is referred to in run Period(93..93, run = 3)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.staleSymbolError(Denotations.scala:952)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:756)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.toNewRun$1(Denotations.scala:803)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:874)
	at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:122)
	at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:116)
	at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:109)
	at dotty.tools.dotc.core.Symbols$Symbol.name(Symbols.scala:262)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames$$anonfun$2(SymDenotations.scala:2358)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:575)
	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:573)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1300)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames(SymDenotations.scala:2358)
	at dotty.tools.dotc.core.SymDenotations$MemberNamesImpl.apply(SymDenotations.scala:2943)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.memberNames(SymDenotations.scala:2340)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames$$anonfun$1(SymDenotations.scala:2350)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames(SymDenotations.scala:2351)
	at dotty.tools.dotc.core.SymDenotations$MemberNamesImpl.apply(SymDenotations.scala:2943)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.memberNames(SymDenotations.scala:2340)
	at dotty.tools.dotc.core.Types$Type.memberNames(Types.scala:934)
	at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.sortedMembersBasedOnFlags(BCodeHelpers.scala:[520](https://github.com/VirtusLab/community-build3/actions/runs/5489142048/jobs/10007265342#step:6:521))
	at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.addForwarders(BCodeHelpers.scala:489)
	at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.addForwarders$(BCodeHelpers.scala:406)
	at dotty.tools.backend.jvm.BCodeHelpers$JCommonBuilder.addForwarders(BCodeHelpers.scala:570)
	at dotty.tools.backend.jvm.BCodeHelpers$JMirrorBuilder.genMirrorClass(BCodeHelpers.scala:617)
	at dotty.tools.backend.jvm.CodeGen.genMirrorClass(CodeGen.scala:145)
	at dotty.tools.backend.jvm.CodeGen.genClassDef$1(CodeGen.scala:61)
	at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:101)
	at dotty.tools.backend.jvm.CodeGen.genClassDefs$1$$anonfun$1(CodeGen.scala:99)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:99)
	at dotty.tools.backend.jvm.CodeGen.genUnit(CodeGen.scala:104)
	at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:76)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331)
	at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:87)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:279)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:200)
	at dotty.tools.dotc.Driver.finish(Driver.scala:58)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
	at dotty.tools.dotc.Driver.process(Driver.scala:197)
	at dotty.tools.dotc.Driver.process(Driver.scala:165)
	at dotty.tools.dotc.Driver.process(Driver.scala:177)
	at dotty.tools.dotc.Driver.main(Driver.scala:207)
	at dotty.tools.dotc.Main.main(Main.scala)
Error while emitting /build/repo/src/demo/Demo.scala
stale symbol; method columnsWithNames$lzyINIT1#52597 in class Table, defined in Period(77..94, run = 2), is referred to in run Period(93..93, run = 3)
dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method columns$lzyINIT1#52605 in class Table, defined in Period(77..94, run = 2), is referred to in run Period(93..93, run = 3)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.staleSymbolError(Denotations.scala:952)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:756)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.toNewRun$1(Denotations.scala:803)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:874)
	at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:122)
	at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:116)
	at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:109)
	at dotty.tools.dotc.core.Symbols$Symbol.name(Symbols.scala:262)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames$$anonfun$2(SymDenotations.scala:2358)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:575)
	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:573)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1300)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames(SymDenotations.scala:2358)
	at dotty.tools.dotc.core.SymDenotations$MemberNamesImpl.apply(SymDenotations.scala:2943)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.memberNames(SymDenotations.scala:2340)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames$$anonfun$1(SymDenotations.scala:2350)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames(SymDenotations.scala:2351)
	at dotty.tools.dotc.core.SymDenotations$MemberNamesImpl.apply(SymDenotations.scala:2943)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.memberNames(SymDenotations.scala:2340)
	at dotty.tools.dotc.core.Types$Type.memberNames(Types.scala:934)
	at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.sortedMembersBasedOnFlags(BCodeHelpers.scala:520)
	at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.addForwarders(BCodeHelpers.scala:489)
	at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.addForwarders$(BCodeHelpers.scala:406)
	at dotty.tools.backend.jvm.BCodeHelpers$JCommonBuilder.addForwarders(BCodeHelpers.scala:570)
	at dotty.tools.backend.jvm.BCodeHelpers$JMirrorBuilder.genMirrorClass(BCodeHelpers.scala:617)
	at dotty.tools.backend.jvm.CodeGen.genMirrorClass(CodeGen.scala:145)
	at dotty.tools.backend.jvm.CodeGen.genClassDef$1(CodeGen.scala:61)
	at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:101)
	at dotty.tools.backend.jvm.CodeGen.genClassDefs$1$$anonfun$1(CodeGen.scala:99)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:99)
	at dotty.tools.backend.jvm.CodeGen.genUnit(CodeGen.scala:104)
	at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:76)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331)
	at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:87)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:279)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:200)
	at dotty.tools.dotc.Driver.finish(Driver.scala:58)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
	at dotty.tools.dotc.Driver.process(Driver.scala:197)
	at dotty.tools.dotc.Driver.process(Driver.scala:165)
	at dotty.tools.dotc.Driver.process(Driver.scala:177)
	at dotty.tools.dotc.Driver.main(Driver.scala:207)
	at dotty.tools.dotc.Main.main(Main.scala)
Error while emitting /build/repo/src/demo/Demo.scala
stale symbol; method columns$lzyINIT1#[526](https://github.com/VirtusLab/community-build3/actions/runs/5489142048/jobs/10007265342#step:6:527)05 in class Table, defined in Period(77..94, run = 2), is referred to in run Period(93..93, run = 3)
dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method colToName$lzyINIT1#52613 in class Table, defined in Period(77..94, run = 2), is referred to in run Period(93..93, run = 3)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.staleSymbolError(Denotations.scala:952)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:756)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.toNewRun$1(Denotations.scala:803)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:874)
	at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:122)
	at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:116)
	at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:109)
	at dotty.tools.dotc.core.Symbols$Symbol.name(Symbols.scala:262)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames$$anonfun$2(SymDenotations.scala:2358)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:575)
	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:573)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1300)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames(SymDenotations.scala:2358)
	at dotty.tools.dotc.core.SymDenotations$MemberNamesImpl.apply(SymDenotations.scala:2943)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.memberNames(SymDenotations.scala:2340)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames$$anonfun$1(SymDenotations.scala:2350)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames(SymDenotations.scala:2351)
	at dotty.tools.dotc.core.SymDenotations$MemberNamesImpl.apply(SymDenotations.scala:2943)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.memberNames(SymDenotations.scala:2340)
	at dotty.tools.dotc.core.Types$Type.memberNames(Types.scala:934)
	at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.sortedMembersBasedOnFlags(BCodeHelpers.scala:520)
	at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.addForwarders(BCodeHelpers.scala:489)
	at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.addForwarders$(BCodeHelpers.scala:406)
	at dotty.tools.backend.jvm.BCodeHelpers$JCommonBuilder.addForwarders(BCodeHelpers.scala:570)
	at dotty.tools.backend.jvm.BCodeHelpers$JMirrorBuilder.genMirrorClass(BCodeHelpers.scala:617)
	at dotty.tools.backend.jvm.CodeGen.genMirrorClass(CodeGen.scala:145)
	at dotty.tools.backend.jvm.CodeGen.genClassDef$1(CodeGen.scala:61)
	at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:101)
	at dotty.tools.backend.jvm.CodeGen.genClassDefs$1$$anonfun$1(CodeGen.scala:99)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:99)
	at dotty.tools.backend.jvm.CodeGen.genUnit(CodeGen.scala:104)
	at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:76)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331)
	at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:87)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:279)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:200)
	at dotty.tools.dotc.Driver.finish(Driver.scala:58)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
	at dotty.tools.dotc.Driver.process(Driver.scala:197)
	at dotty.tools.dotc.Driver.process(Driver.scala:165)
	at dotty.tools.dotc.Driver.process(Driver.scala:177)
	at dotty.tools.dotc.Driver.main(Driver.scala:207)
	at dotty.tools.dotc.Main.main(Main.scala)
Error while emitting /build/repo/src/demo/Demo.scala
stale symbol; method colToName$lzyINIT1#52613 in class Table, defined in Period(77..94, run = 2), is referred to in run Period(93..93, run = 3)
dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method colToExpr$lzyINIT1#52621 in class Table, defined in Period(77..94, run = 2), is referred to in run Period(93..93, run = 3)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.staleSymbolError(Denotations.scala:952)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:756)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.toNewRun$1(Denotations.scala:803)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:874)
	at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:122)
	at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:116)
	at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:109)
	at dotty.tools.dotc.core.Symbols$Symbol.name(Symbols.scala:262)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames$$anonfun$2(SymDenotations.scala:2358)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:575)
	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:573)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1300)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames(SymDenotations.scala:2358)
	at dotty.tools.dotc.core.SymDenotations$MemberNamesImpl.apply(SymDenotations.scala:2943)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.memberNames(SymDenotations.scala:2340)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames$$anonfun$1(SymDenotations.scala:2350)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeMemberNames(SymDenotations.scala:2351)
	at dotty.tools.dotc.core.SymDenotations$MemberNamesImpl.apply(SymDenotations.scala:2943)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.memberNames(SymDenotations.scala:2340)
	at dotty.tools.dotc.core.Types$Type.memberNames(Types.scala:934)
	at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.sortedMembersBasedOnFlags(BCodeHelpers.scala:520)
	at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.addForwarders(BCodeHelpers.scala:489)
	at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.addForwarders$(BCodeHelpers.scala:406)
	at dotty.tools.backend.jvm.BCodeHelpers$JCommonBuilder.addForwarders(BCodeHelpers.scala:[570](https://github.com/VirtusLab/community-build3/actions/runs/5489142048/jobs/10007265342#step:6:571))
	at dotty.tools.backend.jvm.BCodeHelpers$JMirrorBuilder.genMirrorClass(BCodeHelpers.scala:617)
	at dotty.tools.backend.jvm.CodeGen.genMirrorClass(CodeGen.scala:145)
	at dotty.tools.backend.jvm.CodeGen.genClassDef$1(CodeGen.scala:61)
	at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:101)
	at dotty.tools.backend.jvm.CodeGen.genClassDefs$1$$anonfun$1(CodeGen.scala:99)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:99)
	at dotty.tools.backend.jvm.CodeGen.genUnit(CodeGen.scala:104)
	at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:76)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331)
	at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:87)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:279)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:200)
	at dotty.tools.dotc.Driver.finish(Driver.scala:58)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
	at dotty.tools.dotc.Driver.process(Driver.scala:197)
	at dotty.tools.dotc.Driver.process(Driver.scala:165)
	at dotty.tools.dotc.Driver.process(Driver.scala:177)
	at dotty.tools.dotc.Driver.main(Driver.scala:207)
	at dotty.tools.dotc.Main.main(Main.scala)
Error while emitting /build/repo/src/demo/Demo.scala
stale symbol; method colToExpr$lzyINIT1#52[621](https://github.com/VirtusLab/community-build3/actions/runs/5489142048/jobs/10007265342#step:6:622) in class Table, defined in Period(77..94, run = 2), is referred to in run Period(93..93, run = 3)
@WojciechMazur WojciechMazur added itype:bug area:backend itype:crash stat:needs minimization Needs a self contained minimization regression This worked in a previous version but doesn't anymore stat:needs bisection Need to use nightly builds and git bisect to find out the commit where this issue was introduced labels Jul 10, 2023
@WojciechMazur WojciechMazur self-assigned this Jul 10, 2023
@soronpo
Copy link
Contributor

soronpo commented Jul 12, 2023

Did you check the 3.3.2 nightly after #18077 was merged? It handles a stale symbol error like this.

@WojciechMazur
Copy link
Contributor Author

Did you check the 3.3.2 nightly after #18077 was merged? It handles a stale symbol error like this.

Yes, it still fails in latest nightly: 3.3.2-RC1-bin-20230710-ed319e8-NIGHTLY

@Kordyjan Kordyjan added the Spree Suitable for a future Spree label Jul 17, 2023
@mbovel
Copy link
Member

mbovel commented Jul 17, 2023

@KuceraMartin, we will actually have a spree on August 1st. Would you like to look into this issue then?

@WojciechMazur
Copy link
Contributor Author

The crash happens when compiling this test: https://github.com/KuceraMartin/tyqu/blob/c1747edc67ae69cfecd5c5f2ee00c5dc7643e158/src/test/translators/GenericSqlTranslatorTest.scala#L324-L335

It can be simplified to:

  case object MyTable extends Table:
    val id = Column[Int]()
    val firstName = Column[String]()
    val lastName = Column[String]()
    val age = Column[Int | Null]()

  val translator = new GenericSqlTranslator(MySqlPlatform)
  val query = translator.translate(
    from(MyTable).map { t =>
        (t.id - t.age.getOrElse(0) * t.id)
      }
    )

From what I've observed it fails when we reference at least 2 different columns, and use one of them at least twice

@KuceraMartin
Copy link
Contributor

@mbovel I’d be happy to work on it during the next spree but I’m away and with poor internet connection so I haven’t been able to register. Is it fine if I just join the zoom call without signing up?

@WojciechMazur WojciechMazur removed their assignment Jul 24, 2023
@KuceraMartin
Copy link
Contributor

The problem appears starting from this commit: KuceraMartin/tyqu@2cc26d5

It also doesn't compile with Scala 3.2.0. (that is an issue we knew of but did not investigate because it was working again in 3.2.2., see https://lampepfl.slack.com/archives/C0L95M1J8/p1674819778873259)

@mbovel
Copy link
Member

mbovel commented Aug 7, 2023

Thanks for investigating this!

And sorry I didn't answer the previous message; I was on vacation.

@scala-center-bot
Copy link

This issue was picked for the Issue Spree No. 35 of 22 August 2023 which takes place in 7 days. @mbovel, @KuceraMartin will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

@mbovel
Copy link
Member

mbovel commented Aug 23, 2023

Minimized to (test.scala):

abstract sealed class Expression[T]
case class Aggregation[T]() extends Expression[T | Null]
case class Plus[T <: Int | Null, E1 <: Expression[T]](lhs: E1) extends Expression[T]

class GenericSqlTranslator:
  def translateExpression(expr: Expression[?]): Unit =
    expr match
      case Plus(lhs) => ()
$ scala-cli compile -S 3.2.2 test.scala
...

$ scala-cli compile -S 3.3.0 test.scala
...
Error: Unexpected error when compiling project_23be26abb2-261c9906cb: 'Cyclic reference involving class Null'
Compilation failed

$ scala-cli compile -S 3.3.2-RC1-bin-20230707-7ede150-NIGHTLY test.scala
...
Error: Unexpected error when compiling project_6057c39ada-261c9906cb: 'Cyclic reference involving class Null'
Compilation failed

$ scala-cli compile -S 3.4.0-RC1-bin-20230821-6e370a9-NIGHTLY test.scala
...
Error: Unexpected error when compiling project_a76de3a968-261c9906cb: 'Cyclic reference involving class Null'
Compilation failed
Stack trace
Exception in thread "main" dotty.tools.dotc.core.CyclicReference: Cyclic reference involving class Null
        at dotty.tools.dotc.core.CyclicReference$.apply(TypeErrors.scala:178)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.ensureAcyclic$1(SymDenotations.scala:2196)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.recur$4(SymDenotations.scala:2205)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeAndOrType$1(SymDenotations.scala:2302)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.recur$4(SymDenotations.scala:2312)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeAndOrType$1(SymDenotations.scala:2301)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.recur$4(SymDenotations.scala:2312)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.recur$4(SymDenotations.scala:2272)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeTypeRef$1(SymDenotations.scala:2246)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.recur$4(SymDenotations.scala:2254)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeAndOrType$1(SymDenotations.scala:2302)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.recur$4(SymDenotations.scala:2312)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseTypeOf(SymDenotations.scala:2332)
        at dotty.tools.dotc.core.Types$Type.baseType(Types.scala:1173)
        at dotty.tools.dotc.core.TypeComparer.nonExprBaseType(TypeComparer.scala:1572)
        at dotty.tools.dotc.core.TypeComparer.tryBaseType$1(TypeComparer.scala:901)
        at dotty.tools.dotc.core.TypeComparer.thirdTryNamed$1(TypeComparer.scala:594)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:632)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:482)
        at dotty.tools.dotc.core.TypeComparer.compareNamed$1(TypeComparer.scala:338)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:344)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1554)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:516)
        at dotty.tools.dotc.core.TypeComparer.compareNamed$1(TypeComparer.scala:338)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:344)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1554)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:215)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:225)
        at dotty.tools.dotc.core.TypeComparer.isSub(TypeComparer.scala:227)
        at dotty.tools.dotc.core.ConstraintHandling.op$proxy3$1(ConstraintHandling.scala:471)
        at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:471)
        at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen$(ConstraintHandling.scala:29)
        at dotty.tools.dotc.core.TypeComparer.isSubTypeWhenFrozen(TypeComparer.scala:31)
        at dotty.tools.dotc.core.TypeComparer$.isSubTypeWhenFrozen(TypeComparer.scala:3043)
        at dotty.tools.dotc.core.Types$Type.frozen_$less$colon$less(Types.scala:1083)
        at dotty.tools.dotc.typer.Inferencing$.maximizeType$$anonfun$1(Inferencing.scala:424)
        at scala.runtime.function.JProcedure2.apply(JProcedure2.java:15)
        at scala.runtime.function.JProcedure2.apply(JProcedure2.java:10)
        at dotty.tools.dotc.util.SimpleIdentityMap$Map2.foreachBinding(SimpleIdentityMap.scala:85)
        at dotty.tools.dotc.typer.Inferencing$.maximizeType(Inferencing.scala:433)
        at dotty.tools.dotc.core.TypeOps$.instantiate$3(TypeOps.scala:917)
        at dotty.tools.dotc.core.TypeOps$.instantiateToSubType(TypeOps.scala:924)
        at dotty.tools.dotc.core.TypeOps$.refineUsingParent(TypeOps.scala:757)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.$anonfun$14(Space.scala:649)
        at scala.collection.immutable.List.map(List.scala:246)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.rec$1(Space.scala:660)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.decompose$$anonfun$2(Space.scala:668)
        at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:105)
        at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:81)
        at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:36)
        at dotty.tools.dotc.reporting.trace$force$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:23)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.decompose(Space.scala:605)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$Parts$.unapply(Space.scala:688)
        at dotty.tools.dotc.transform.patmat.Typ.decompose(Space.scala:105)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.decompose(Space.scala:124)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.computeSimplify(Space.scala:139)
        at dotty.tools.dotc.transform.patmat.Space.simplify(Space.scala:81)
        at dotty.tools.dotc.transform.patmat.Space.simplify$(Space.scala:61)
        at dotty.tools.dotc.transform.patmat.Typ.simplify(Space.scala:96)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.simplify(Space.scala:121)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.$anonfun$2(Space.scala:129)
        at dotty.tools.dotc.core.Decorators$.loop$1(Decorators.scala:94)
        at dotty.tools.dotc.core.Decorators$.mapconserve(Decorators.scala:110)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.computeSimplify(Space.scala:129)
        at dotty.tools.dotc.transform.patmat.Space.simplify(Space.scala:81)
        at dotty.tools.dotc.transform.patmat.Space.simplify$(Space.scala:61)
        at dotty.tools.dotc.transform.patmat.Prod.simplify(Space.scala:113)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.simplify(Space.scala:121)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.$anonfun$3(Space.scala:134)
        at scala.collection.immutable.List.map(List.scala:246)
        at scala.collection.immutable.List.map(List.scala:79)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.computeSimplify(Space.scala:134)
        at dotty.tools.dotc.transform.patmat.Space.simplify(Space.scala:81)
        at dotty.tools.dotc.transform.patmat.Space.simplify$(Space.scala:61)
        at dotty.tools.dotc.transform.patmat.Or.simplify(Space.scala:116)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.simplify(Space.scala:121)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.checkRedundancy$$anonfun$2(Space.scala:940)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.checkRedundancy$$anonfun$adapted$1(Space.scala:963)
        at dotty.tools.dotc.reporting.TraceSyntax.doTrace(trace.scala:105)
        at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:81)
        at dotty.tools.dotc.reporting.TraceSyntax.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace$(trace.scala:36)
        at dotty.tools.dotc.reporting.trace$force$.dotty$tools$dotc$reporting$TraceSyntax$$inline$doTrace(trace.scala:23)
        at dotty.tools.dotc.transform.patmat.SpaceEngine$.checkRedundancy(Space.scala:912)
        at dotty.tools.dotc.transform.PatternMatcher.transformMatch(PatternMatcher.scala:53)
        at dotty.tools.dotc.transform.MegaPhase.goMatch(MegaPhase.scala:804)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:371)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:442)
        at dotty.tools.dotc.transform.MegaPhase.mapDefDef$1(MegaPhase.scala:253)
        at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:256)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:440)
        at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:453)
        at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:453)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:364)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:442)
        at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:260)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:440)
        at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:453)
        at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:453)
        at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:384)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:387)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:442)
        at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:469)
        at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:481)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327)
        at scala.collection.immutable.List.map(List.scala:246)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:71)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:279)
        at dotty.tools.dotc.Run.compileSources(Run.scala:194)
        at dotty.tools.dotc.Run.compile(Run.scala:179)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
        at dotty.tools.dotc.Driver.process(Driver.scala:197)
        at dotty.tools.dotc.Driver.process(Driver.scala:165)
        at dotty.tools.dotc.Driver.process(Driver.scala:177)
        at dotty.tools.dotc.Driver.main(Driver.scala:207)
        at dotty.tools.MainGenericCompiler$.run$1(MainGenericCompiler.scala:162)
        at dotty.tools.MainGenericCompiler$.main(MainGenericCompiler.scala:186)
        at dotty.tools.MainGenericCompiler.main(MainGenericCompiler.scala)

@mbovel mbovel removed the stat:needs minimization Needs a self contained minimization label Aug 23, 2023
@KuceraMartin
Copy link
Contributor

The regression occurs multiple times (i.e. there are many commits on which it works and many on which it doesn't) so bisection doesn't work. I have identified 1 commit on which it breaks: 2d641ec

@smarter
Copy link
Member

smarter commented Sep 15, 2023

I've been looking into this and one thing that makes it really hard to properly understand what's going on here is the use of maximizeType. It has a lot of complex logic to deal with GADT instantiations involving create extra type variables which is how we end up with a cycle here. Is any of this stuff actually necessary for the call-site in Space.scala? /cc @dwijnand

@dwijnand
Copy link
Member

Well, yeah, when trying to find the instantiation of a subclass such that it's a subtype, maximising is correct, to avoid considering only a subset of values. So given a type argument (as a part of protoTp1) that's in invariant position, it's important not to arbitrarily pick one of the bounds. Now maybe it's fine for it to stay as an uninstantiated type var, rather than instantiated to a fresh symbol. Even more so, I don't know if it's necessary to add the fresh symbol to the gadt constraint - but perhaps there's a nested match test case that demonstrates that need to create a fresh symbol and add it.. Arbitrarily picking one of the bounds very likely leads to false positives - probably false positive exhaustivity warnings if the SpaceEngine instantiates a bigger type for the decomposition of the scrutinee type than Typer assigned to the unapply extractor.

@smarter
Copy link
Member

smarter commented Oct 4, 2023

Now maybe it's fine for it to stay as an uninstantiated type var, rather than instantiated to a fresh symbol.

Yeah that's what I had in mind, these symbols only make sense during typechecking for GADT it seems.

@mbovel mbovel removed the Spree Suitable for a future Spree label Jan 30, 2024
@WojciechMazur
Copy link
Contributor Author

Seems to be fixed in 3.4.2-RC1-bin-20240214-e96cb18-NIGHTLY, not sure which exact change caused that.
@Kordyjan Maybe we should check if the fixes were backported to LTS line?

@dwijnand
Copy link
Member

dwijnand commented Mar 2, 2024

It may have been 3b03592

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:backend itype:bug itype:crash regression This worked in a previous version but doesn't anymore stat:needs bisection Need to use nightly builds and git bisect to find out the commit where this issue was introduced
Projects
None yet
Development

No branches or pull requests

8 participants