Skip to content

REPL crashes when interpreting foldLeft #7472

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

Closed
Soya-Onishi opened this issue Oct 30, 2019 · 2 comments
Closed

REPL crashes when interpreting foldLeft #7472

Soya-Onishi opened this issue Oct 30, 2019 · 2 comments
Assignees

Comments

@Soya-Onishi
Copy link

As described in the title, REPL crashes when run below example in REPL.
This crash does not happen if I create a file, compile the code and run dotr.

minimized code

in REPL,

val list = List(1, 2, 3)
list.foldLeft(List.empty[Int]){ case (acc, n) => n :: acc }

environment

  • dotr: version 0.19.0-RC1
  • OS: Linux soya 5.0.0-32-generic #34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Stack trace
Exception in thread "main" java.lang.AssertionError: assertion failed: denotation module class immutable invalid in run 3. ValidFor: Period(1..71, run = 5)
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.updateValidity(Denotations.scala:828)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:857)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:912)
	at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:486)
	at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:481)
	at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:475)
	at dotty.tools.dotc.core.Symbols$.toDenot(Symbols.scala:847)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.declIn$1(Scala2Unpickler.scala:383)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.fromName$1(Scala2Unpickler.scala:384)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.readExtSymbol$1(Scala2Unpickler.scala:415)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.readDisambiguatedSymbol(Scala2Unpickler.scala:442)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.readSymbol(Scala2Unpickler.scala:343)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.readSymbolRef(Scala2Unpickler.scala:872)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.readChildren$$anonfun$2$$anonfun$1(Scala2Unpickler.scala:861)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.atReadPos(Scala2Unpickler.scala:325)
	at dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler.readChildren$$anonfun$1(Scala2Unpickler.scala:861)
	at dotty.tools.dotc.core.Annotations$Annotation$Child$.makeChildLater$1(Annotations.scala:158)
	at dotty.tools.dotc.core.Annotations$Annotation$Child$.later$$anonfun$1(Annotations.scala:162)
	at dotty.tools.dotc.core.Annotations$$anon$1.complete(Annotations.scala:124)
	at dotty.tools.dotc.core.Annotations$LazyAnnotation.tree(Annotations.scala:56)
	at dotty.tools.dotc.core.Annotations$Annotation$Child$.unapply(Annotations.scala:170)
	at dotty.tools.dotc.transform.SymUtils$$anon$1.applyOrElse(SymUtils.scala:190)
	at dotty.tools.dotc.transform.SymUtils$$anon$1.applyOrElse(SymUtils.scala:190)
	at scala.collection.immutable.List.collect(List.scala:239)
	at dotty.tools.dotc.transform.SymUtils$.children$extension(SymUtils.scala:190)
	at dotty.tools.dotc.transform.SymUtils$.hasAnonymousChild$extension(SymUtils.scala:195)
	at dotty.tools.dotc.transform.patmat.SpaceEngine.canDecompose(Space.scala:555)
	at dotty.tools.dotc.transform.patmat.SpaceLogic.intersect(Space.scala:197)
	at dotty.tools.dotc.transform.patmat.SpaceEngine.intersect(Space.scala:287)
	at dotty.tools.dotc.transform.patmat.SpaceLogic.intersect$$anonfun$1(Space.scala:192)
	at scala.collection.immutable.List.map(List.scala:223)
	at dotty.tools.dotc.transform.patmat.SpaceLogic.intersect(Space.scala:192)
	at dotty.tools.dotc.transform.patmat.SpaceEngine.intersect(Space.scala:287)
	at dotty.tools.dotc.transform.patmat.SpaceLogic.minus$$anonfun$4(Space.scala:260)
	at scala.collection.immutable.List.exists(List.scala:367)
	at dotty.tools.dotc.transform.patmat.SpaceLogic.minus(Space.scala:260)
	at dotty.tools.dotc.transform.patmat.SpaceEngine.minus(Space.scala:287)
	at dotty.tools.dotc.transform.patmat.SpaceLogic.minus(Space.scala:240)
	at dotty.tools.dotc.transform.patmat.SpaceEngine.minus(Space.scala:287)
	at dotty.tools.dotc.transform.patmat.SpaceEngine.checkExhaustivity(Space.scala:743)
	at dotty.tools.dotc.transform.PatternMatcher.transformMatch(PatternMatcher.scala:39)
	at dotty.tools.dotc.transform.MegaPhase.goMatch(MegaPhase.scala:746)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:345)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.mapDefDef$1(MegaPhase.scala:245)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:248)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:394)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:404)
	at dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:409)
	at scala.collection.immutable.List.mapConserve(List.scala:444)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:409)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:286)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.transformTrees$$anonfun$1(MegaPhase.scala:420)
	at scala.collection.immutable.List.mapConserve(List.scala:444)
	at dotty.tools.dotc.transform.MegaPhase.transformTrees(MegaPhase.scala:420)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:271)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.mapValDef$1(MegaPhase.scala:234)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:238)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:394)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:404)
	at dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:409)
	at scala.collection.immutable.List.mapConserve(List.scala:444)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:409)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:339)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:251)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:394)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:404)
	at dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:409)
	at scala.collection.immutable.List.mapConserve(List.scala:444)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:409)
	at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:356)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:359)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:415)
	at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:427)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:315)
	at scala.collection.immutable.List.map(List.scala:219)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:316)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:159)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:169)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:177)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:184)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:126)
	at dotty.tools.repl.ReplCompiler.runCompilationUnit(ReplCompiler.scala:156)
	at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:166)
	at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:227)
	at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:193)
	at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:127)
	at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:130)
	at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:148)
	at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:130)
	at dotty.tools.repl.Main$.main(Main.scala:6)
	at dotty.tools.repl.Main.main(Main.scala)
@OlivierBlanvillain
Copy link
Contributor

Reproduced, if someone wants to bisect this issue was not present at 9ca016e

@scala scala deleted a comment from bishabosha Nov 1, 2019
@bishabosha
Copy link
Member

So having learned how parents of commits work,

the last working commit is f70fdd1, and it has a linear chain of children that do not compile until f49bee1, where the error can be observed

bishabosha added a commit that referenced this issue Nov 6, 2019
Fix #7472: Pass correct context in Child.later
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants