Skip to content

Assertion failed: Attempt to commit TS[...] into already committed TS[...] #14907

Closed
@FlorianCassayre

Description

@FlorianCassayre

Compiler version

3.1.3-RC1-bin-20220410-220b753-NIGHTLY down to 3.0.1 using -Yforce-sbt-phases

Minimized code

object Module {
  class Fun[N <: Int]()
  type Fill[N <: Int] = N match {
    case 0 => EmptyTuple
    case 1 => Any *: Fill[0]
  }
  extension[N <: Int] (f: Fun[N])
    def apply: Fill[N] => Any = ???

  Fun[1]()(???)
}

Output (click arrow to expand)

scalac: Error: assertion failed: Attempt to commit TS[3046177X, 3045800X, 3030389, 3030388, 3030387] into already committed TS[3045800X, 3030389, 3030388, 3030387]
java.lang.AssertionError: assertion failed: Attempt to commit TS[3046177X, 3045800X, 3030389, 3030388, 3030387] into already committed TS[3045800X, 3030389, 3030388, 3030387]
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.core.TyperState.commit(TyperState.scala:154)
	at dotty.tools.dotc.typer.Inferencing$.isFullyDefined(Inferencing.scala:40)
	at dotty.tools.dotc.core.TypeOps$.simplify(TypeOps.scala:145)
	at dotty.tools.dotc.core.TypeOps$SimplifyMap.apply(TypeOps.scala:189)
	at dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:5609)
	at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:2887)
	at dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:5608)
	at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:2887)
	at dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:5608)
	at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:2887)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:321)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1309)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:189)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:199)
	at dotty.tools.dotc.core.TypeComparer.isSubArg$1(TypeComparer.scala:1519)
	at dotty.tools.dotc.core.TypeComparer.recurArgs$1(TypeComparer.scala:1523)
	at dotty.tools.dotc.core.TypeComparer.isSubArgs(TypeComparer.scala:1526)
	at dotty.tools.dotc.core.TypeComparer.loop$1(TypeComparer.scala:1096)
	at dotty.tools.dotc.core.TypeComparer.isMatchingApply$1(TypeComparer.scala:1111)
	at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:1181)
	at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:559)
	at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:492)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:378)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1309)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:189)
	at dotty.tools.dotc.core.TypeComparer.tryBaseType$1(TypeComparer.scala:749)
	at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:1190)
	at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:559)
	at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:492)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:378)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1309)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:189)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:199)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:126)
	at dotty.tools.dotc.core.TypeComparer.necessarySubType(TypeComparer.scala:137)
	at dotty.tools.dotc.core.TypeComparer$.necessarySubType(TypeComparer.scala:2712)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.necessarilyCompatible(ProtoTypes.scala:47)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.necessarilyCompatible$(ProtoTypes.scala:26)
	at dotty.tools.dotc.typer.Typer.necessarilyCompatible(Typer.scala:119)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:97)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult$(ProtoTypes.scala:26)
	at dotty.tools.dotc.typer.Typer.constrainResult(Typer.scala:119)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:117)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult$(ProtoTypes.scala:26)
	at dotty.tools.dotc.typer.Typer.constrainResult(Typer.scala:119)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:438)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:735)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:852)
	at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1052)
	at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:317)
	at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:119)
	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:898)
	at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$3(Applications.scala:978)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3081)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:989)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1027)
	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:317)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:119)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2809)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2872)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
	at dotty.tools.dotc.typer.Typer.typedTuple(Typer.scala:2720)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2846)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2872)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$7(ProtoTypes.scala:462)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:386)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:463)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:853)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:853)
	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:544)
	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:609)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:447)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:735)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:852)
	at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1052)
	at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:317)
	at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:119)
	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:898)
	at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$3(Applications.scala:978)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3081)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:989)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1027)
	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:317)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:119)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2809)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2872)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3057)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1075)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2817)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2872)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3057)
	at dotty.tools.dotc.typer.Typer.caseRest$1(Typer.scala:1684)
	at dotty.tools.dotc.typer.Typer.typedCase(Typer.scala:1700)
	at dotty.tools.dotc.typer.Typer.typedCases$$anonfun$1(Typer.scala:1630)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:92)
	at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:108)
	at dotty.tools.dotc.typer.Typer.typedCases(Typer.scala:1632)
	at dotty.tools.dotc.typer.Typer.$anonfun$26(Typer.scala:1622)
	at dotty.tools.dotc.typer.Applications.harmonic(Applications.scala:2187)
	at dotty.tools.dotc.typer.Applications.harmonic$(Applications.scala:317)
	at dotty.tools.dotc.typer.Typer.harmonic(Typer.scala:119)
	at dotty.tools.dotc.typer.Typer.typedMatchFinish(Typer.scala:1622)
	at dotty.tools.dotc.typer.Typer.typedMatch(Typer.scala:1578)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2823)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2872)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3057)
	at dotty.tools.dotc.typer.Typer.$anonfun$47(Typer.scala:2256)
	at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:238)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2256)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2786)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2871)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2963)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3013)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2454)
	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2797)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2801)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2871)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2963)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3013)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2581)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2842)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2872)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3057)
	at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
	at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:411)
	at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:54)
	at dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:88)
	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.typer.TyperPhase.runOn(TyperPhase.scala:88)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:259)
	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:270)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:278)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:287)
	at dotty.tools.dotc.Run.compileSources(Run.scala:220)
	at dotty.tools.dotc.Run.compile(Run.scala:204)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
	at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
	at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
	at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:57)
	at org.jetbrains.jps.incremental.scala.local.LocalServer.doCompile(LocalServer.scala:52)
	at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:30)
	at org.jetbrains.jps.incremental.scala.remote.Main$.compileLogic(Main.scala:207)
	at org.jetbrains.jps.incremental.scala.remote.Main$.$anonfun$handleCommand$1(Main.scala:190)
	at org.jetbrains.jps.incremental.scala.remote.Main$.decorated$1(Main.scala:180)
	at org.jetbrains.jps.incremental.scala.remote.Main$.handleCommand(Main.scala:187)
	at org.jetbrains.jps.incremental.scala.remote.Main$.serverLogic(Main.scala:163)
	at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:103)
	at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
	at jdk.internal.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)

The compiler outputs additional stuff to the standard output.

This code compiles on 3.0.0, but not on 3.0.1 and later.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions