-
Notifications
You must be signed in to change notification settings - Fork 1.1k
cyclic reference crash with -from-tasty
with parents/params loop
#12872
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
Comments
This looks pretty hard to fix. What happens is:
One way to fix this would be to carefully analyze what Namer does in this case (it's not pretty!) and duplicate the same behavior in TreeUnpickler. But I don't have the bandwidth to do this right now, so it would be good is someone else could take a look. @bishabosha can you try, or find somebody else to take this on? |
Can be reproduced with |
I found a very similar issue recently when trying to migrate Reproduction:// _1.scala
class Ctx(rx0: Ctx.Owner)
object Ctx {
class Owner() extends Ctx(???)
} // _2.scala
def test = {
Ctx.Owner
} Crash msg:java.lang.AssertionError: assertion failed: Cyclic reference while unpickling definition at address 35 in unit main.scala while compiling Ctx.tasty
Exception in thread "main" java.lang.AssertionError: assertion failed: Cyclic reference while unpickling definition at address 35 in unit main.scala
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:796)
at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.liftedTree1$1(TreeUnpickler.scala:133)
at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.complete(TreeUnpickler.scala:137)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:171)
at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
at dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:613)
at dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:605)
at dotty.tools.dotc.core.Denotations$SingleDenotation.atSignature(Denotations.scala:647)
at dotty.tools.dotc.core.Denotations$SingleDenotation.atSignature(Denotations.scala:645)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1299)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1373)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1210)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1373)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.$anonfun$19(TreeUnpickler.scala:962)
at dotty.tools.tasty.TastyReader.collectWhile(TastyReader.scala:137)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTemplate(TreeUnpickler.scala:965)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:883)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:802)
at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.liftedTree1$1(TreeUnpickler.scala:133)
at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.complete(TreeUnpickler.scala:137)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:171)
at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:373)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.annotations(SymDenotations.scala:228)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.getAnnotation(SymDenotations.scala:249)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.targetName(SymDenotations.scala:530)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.hasTargetName(SymDenotations.scala:520)
at dotty.tools.dotc.core.Denotations$SingleDenotation.atSignature(Denotations.scala:657)
at dotty.tools.dotc.core.Denotations$SingleDenotation.atSignature(Denotations.scala:645)
at dotty.tools.dotc.core.tasty.TreeUnpickler.dotty$tools$dotc$core$tasty$TreeUnpickler$TreeReader$$_$accessibleDenot$1(TreeUnpickler.scala:1130)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.completeSelect$1(TreeUnpickler.scala:1121)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readSimpleTerm$1(TreeUnpickler.scala:1149)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1373)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTpt(TreeUnpickler.scala:1401)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:911)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:802)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedParams$$anonfun$2(TreeUnpickler.scala:1083)
at dotty.tools.tasty.TastyReader.collectWhile(TastyReader.scala:137)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedParams(TreeUnpickler.scala:1083)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readParams(TreeUnpickler.scala:1088)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readParamss$1(TreeUnpickler.scala:820)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:856)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:802)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTemplate(TreeUnpickler.scala:978)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:883)
at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:802)
at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.liftedTree1$1(TreeUnpickler.scala:133)
at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.complete(TreeUnpickler.scala:137)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:171)
at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:373)
at dotty.tools.dotc.core.Symbols$ClassSymbol.rootTreeContaining(Symbols.scala:396)
at dotty.tools.dotc.core.Symbols$ClassSymbol.rootTree(Symbols.scala:387)
at dotty.tools.dotc.fromtasty.ReadTasty.compilationUnit$1(ReadTasty.scala:40)
at dotty.tools.dotc.fromtasty.ReadTasty.readTASTY(ReadTasty.scala:70)
at dotty.tools.dotc.fromtasty.ReadTasty.runOn$$anonfun$1(ReadTasty.scala:25)
at scala.collection.immutable.List.flatMap(List.scala:293)
at dotty.tools.dotc.fromtasty.ReadTasty.runOn(ReadTasty.scala:25)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:234)
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:1328)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:245)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:253)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:262)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
at dotty.tools.dotc.Run.compileUnits(Run.scala:262)
at dotty.tools.dotc.Run.compileUnits(Run.scala:192)
at dotty.tools.dotc.fromtasty.TASTYRun.compile(TASTYRun.scala:14)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
at dotty.tools.dotc.Driver.process(Driver.scala:195)
at dotty.tools.dotc.Driver.process(Driver.scala:163)
at dotty.tools.dotc.Driver.process(Driver.scala:175)
at dotty.tools.dotc.Driver.main(Driver.scala:205)
at dotty.tools.MainGenericCompiler$.run$1(MainGenericCompiler.scala:162)
at dotty.tools.MainGenericCompiler$.main(MainGenericCompiler.scala:186)
at dotty.tools.MainGenericCompiler.main(MainGenericCompiler.scala)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at coursier.bootstrap.launcher.a.a(Unknown Source)
at coursier.bootstrap.launcher.Launcher.main(Unknown Source) The difference here is that it crashed the compiler ever since The weird thing is also that the following code compiles correctly: ( // _1.scala
class Ctx(rx0: Ctx.Owner)
class Owner() extends Ctx(???) DetailsThe situation here seems to be similar to what @odersky described.
|
Compiler Version
3.0.2-RC1
Minimized code
I can now make a cyclic reference crash when compiling
-from-tasty
with this augmented example totests/pos/i12834.scala
before #12844 this code would create the same error as #12834
Originally posted by @bishabosha in #12844 (comment)
The text was updated successfully, but these errors were encountered: