Skip to content

REPL crashes when interpreting foldLeft #7472

Closed
@Soya-Onishi

Description

@Soya-Onishi

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)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions