Open ChenCMD opened 2 months ago
It's not just the presentation compiler, but typer in general is crashing. Full output:
exception occurred while typechecking /Users/pchabelski/IdeaProjects/scala-cli-tests-2/untitled/compiler-repro/repro.scala
An unhandled exception was thrown in the compiler.
Please file a crash report here:
https://github.com/scala/scala3/issues/new/choose
For non-enriched exceptions, compile with -Xno-enrich-error-messages.
while compiling: /Users/pchabelski/IdeaProjects/scala-cli-tests-2/untitled/compiler-repro/repro.scala
during phase: typer
mode: Mode(ImplicitsEnabled)
library version: version 2.13.14
compiler version: version 3.6.0-RC1-bin-20240907-614170f-NIGHTLY-git-614170f
settings: -classpath /Users/pchabelski/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.6.0-RC1-bin-20240907-614170f-NIGHTLY/scala3-library_3-3.6.0-RC1-bin-20240907-614170f-NIGHTLY.jar:/Users/pchabelski/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.14/scala-library-2.13.14.jar -d /Users/pchabelski/IdeaProjects/scala-cli-tests-2/untitled/compiler-repro/.scala-build/compiler-repro_e1e076a8a4-d9eb8ef26f/classes/main -sourceroot /Users/pchabelski/IdeaProjects/scala-cli-tests-2/untitled/compiler-repro
Exception in thread "main" java.lang.AssertionError: assertion failed: TS[1, 0] attempted to take ownership of F which is already owned by committable TS[9, 1, 0]
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.core.TyperState.includeVar(TyperState.scala:272)
at dotty.tools.dotc.core.TyperState.$anonfun$2$$anonfun$1(TyperState.scala:234)
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:334)
at dotty.tools.dotc.core.TyperState.$anonfun$2(TyperState.scala:233)
at scala.collection.immutable.List.forall(List.scala:387)
at dotty.tools.dotc.core.TyperState.mergeConstraintWith(TyperState.scala:228)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArgs(ProtoTypes.scala:519)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.fold(ProtoTypes.scala:605)
at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6726)
at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6764)
at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:680)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6763)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6763)
at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.fold(ProtoTypes.scala:281)
at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6726)
at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6764)
at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:680)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6763)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6763)
at dotty.tools.dotc.typer.ProtoTypes$ViewProto.fold(ProtoTypes.scala:662)
at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6726)
at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6764)
at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:680)
at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.apply(Implicits.scala:686)
at dotty.tools.dotc.typer.ImplicitRunInfo.recur$1(Implicits.scala:762)
at dotty.tools.dotc.typer.ImplicitRunInfo.computeIScope(Implicits.scala:773)
at dotty.tools.dotc.typer.ImplicitRunInfo.$anonfun$1(Implicits.scala:849)
at dotty.tools.dotc.util.ReadOnlyMap.getOrElse(ReadOnlyMap.scala:23)
at dotty.tools.dotc.typer.ImplicitRunInfo.implicitScope(Implicits.scala:849)
at dotty.tools.dotc.typer.ImplicitRunInfo.implicitScope$(Implicits.scala:624)
at dotty.tools.dotc.Run.implicitScope(Run.scala:43)
at dotty.tools.dotc.typer.Implicits$ImplicitSearch.implicitScope(Implicits.scala:1805)
at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1690)
at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit$$anonfun$2(Implicits.scala:1774)
at dotty.tools.dotc.typer.Implicits$SearchResult.recoverWith(Implicits.scala:430)
at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1760)
at dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1801)
at dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:1109)
at dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:860)
at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:145)
at dotty.tools.dotc.typer.Implicits.inferView(Implicits.scala:900)
at dotty.tools.dotc.typer.Implicits.inferView$(Implicits.scala:860)
at dotty.tools.dotc.typer.Typer.inferView(Typer.scala:145)
at dotty.tools.dotc.typer.Implicits.viewExists(Implicits.scala:873)
at dotty.tools.dotc.typer.Implicits.viewExists$(Implicits.scala:860)
at dotty.tools.dotc.typer.Typer.viewExists(Typer.scala:145)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.necessarilyCompatible(ProtoTypes.scala:53)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.necessarilyCompatible$(ProtoTypes.scala:32)
at dotty.tools.dotc.typer.Typer.necessarilyCompatible(Typer.scala:145)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:104)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult$(ProtoTypes.scala:32)
at dotty.tools.dotc.typer.Typer.constrainResult(Typer.scala:145)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:155)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult$(ProtoTypes.scala:32)
at dotty.tools.dotc.typer.Typer.constrainResult(Typer.scala:145)
at dotty.tools.dotc.typer.Typer.implicitArgs$1(Typer.scala:4142)
at dotty.tools.dotc.typer.Typer.addImplicitArgs$1(Typer.scala:4210)
at dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$1(Typer.scala:4266)
at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4473)
at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4727)
at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3999)
at dotty.tools.dotc.typer.Typer.readapt$1(Typer.scala:4009)
at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4715)
at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3999)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3621)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3625)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3736)
at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:989)
at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:1031)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3434)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3543)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3621)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3625)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3736)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1047)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1240)
at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:434)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:145)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3459)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3544)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$7(ProtoTypes.scala:534)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:457)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:535)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:1003)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:1003)
at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:688)
at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:752)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:574)
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:878)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:1002)
at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1266)
at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:434)
at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:145)
at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:1075)
at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$2(Applications.scala:1185)
at dotty.tools.dotc.typer.Typer$.tryEither(Typer.scala:118)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1200)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1240)
at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:434)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:145)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3459)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3544)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3621)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3625)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3736)
at dotty.tools.dotc.typer.Typer.$anonfun$65(Typer.scala:2878)
at dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2878)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3441)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3543)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3621)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3625)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3647)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3693)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3141)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3447)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3451)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3543)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3621)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3625)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3647)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3693)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3274)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3493)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3544)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3621)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3625)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3736)
at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:503)
at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:53)
at dotty.tools.dotc.typer.TyperPhase.$anonfun$4(TyperPhase.scala:99)
at scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
at scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:583)
at scala.collection.immutable.List.prependedAll(List.scala:152)
at scala.collection.immutable.List$.from(List.scala:685)
at scala.collection.immutable.List$.from(List.scala:682)
at scala.collection.IterableOps$WithFilter.map(Iterable.scala:900)
at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:98)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
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:1323)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:384)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:396)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
at dotty.tools.dotc.Run.compileUnits(Run.scala:396)
at dotty.tools.dotc.Run.compileSources(Run.scala:282)
at dotty.tools.dotc.Run.compile(Run.scala:267)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
at dotty.tools.dotc.Driver.process(Driver.scala:201)
at dotty.tools.dotc.Driver.process(Driver.scala:169)
at dotty.tools.dotc.Driver.process(Driver.scala:181)
at dotty.tools.dotc.Driver.main(Driver.scala:211)
at dotty.tools.dotc.Main.main(Main.scala)
Happens on 3.6.0-RC1-bin-20240907-614170f-NIGHTLY-git-614170f & 3.3.3 as well.
likely a dupe of https://github.com/scala/scala3/issues/20768 / https://github.com/scala/scala3/issues/18687 / https://github.com/scala/scala3/issues/16326 which I had started working on a while ago but didn't get to the bottom of, my bad!
Compiler version
3.6.0-RC1-bin-20240903-21a3d39-NIGHTLY
Minimized code
Output (click arrow to expand)
Maybe related issues
https://github.com/scala/scala3/issues/16326 https://github.com/scala/scala3/issues/20768