Skip to content

Regression crash when using ? as type arg for parameter and then using match type on it #22076

Closed
@szymon-rd

Description

@szymon-rd

Compiler version

3.6.4-RC1-bin-20241201-6bf4483-NIGHTLY
Code does not crash in 3.4.2.

Minimized code

trait Foo[ CP <: NonEmptyTuple ]:
  type EndNode = Tuple.Last [CP]

def f( end : Foo[?] ) : end.EndNode =
  ???

trait Bar[CP <: NonEmptyTuple] extends Foo[CP]:
  val v: EndNode = f(this)

Output (click arrow to expand)

     while compiling: /home/srodziewicz/projects/scalapaths/test.scala
        during phase: typer
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.15
    compiler version: version 3.6.4-RC1-bin-20241201-6bf4483-NIGHTLY-git-6bf4483
            settings: -bootclasspath /home/srodziewicz/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.6.4-RC1-bin-20241201-6bf4483-NIGHTLY/scala3-library_3-3.6.4-RC1-bin-20241201-6bf4483-NIGHTLY.jar:/home/srodziewicz/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.15/scala-library-2.13.15.jar -classpath /home/srodziewicz/projects/scalapaths/.scala-build/.bloop/scalapaths_347eda438f-99f40afdbb/bloop-internal-classes/main-tFhFrMnfQgWaax0XZu7PiA==:/home/srodziewicz/projects/scalapaths/.scala-build/scalapaths_347eda438f-99f40afdbb/classes/classes-empty-scalapaths_347eda438f-99f40afdbb -d /home/srodziewicz/projects/scalapaths/.scala-build/.bloop/scalapaths_347eda438f-99f40afdbb/bloop-internal-classes/main-tFhFrMnfQgWaax0XZu7PiA== -sourceroot /home/srodziewicz/projects/scalapaths

Error compiling project (Scala 3.6.4-RC1-bin-20241201-6bf4483-NIGHTLY, JVM (23))
Error: Unexpected error when compiling scalapaths_347eda438f-99f40afdbb: scala.MatchError: NoType (of class dotty.tools.dotc.core.Types$NoType$)
        at dotty.tools.dotc.core.TypeComparer.disjointnessBoundary$1(TypeComparer.scala:3065)
        at dotty.tools.dotc.core.TypeComparer.provablyDisjoint(TypeComparer.scala:3068)
        at dotty.tools.dotc.core.TypeComparer.provablyDisjoint(TypeComparer.scala:3001)
        at dotty.tools.dotc.core.MatchReducer.matchSpeccedPatMat$1(TypeComparer.scala:3754)
        at dotty.tools.dotc.core.MatchReducer.matchCase$1(TypeComparer.scala:3562)
        at dotty.tools.dotc.core.MatchReducer.recur$2(TypeComparer.scala:3833)
        at dotty.tools.dotc.core.MatchReducer.op$proxy82$1(TypeComparer.scala:3862)
        at dotty.tools.dotc.core.MatchReducer.matchCases(TypeComparer.scala:3862)
        at dotty.tools.dotc.core.Types$MatchType.reduced$$anonfun$1(Types.scala:5154)
        at dotty.tools.dotc.core.TypeComparer.inSubComparer(TypeComparer.scala:3290)
        at dotty.tools.dotc.core.TypeComparer.reduceMatchWith(TypeComparer.scala:3301)
        at dotty.tools.dotc.core.TypeComparer$.reduceMatchWith(TypeComparer.scala:3472)
        at dotty.tools.dotc.core.Types$MatchType.reduced(Types.scala:5154)
        at dotty.tools.dotc.core.Types$Type.tryNormalize(Types.scala:1556)
        at dotty.tools.dotc.core.Types$Type.normalized(Types.scala:1550)
        at dotty.tools.dotc.core.Types$TypeProxy.superTypeNormalized(Types.scala:2158)
        at dotty.tools.dotc.core.TypeComparer.compareAppliedType1$1(TypeComparer.scala:1495)
        at dotty.tools.dotc.core.TypeComparer.fourthTry$1(TypeComparer.scala:1004)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:812)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:570)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:432)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1595)
        at dotty.tools.dotc.core.TypeComparer.compareLower$1(TypeComparer.scala:1420)
        at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:1448)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:643)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:570)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:432)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1595)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:439)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:432)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1595)
        at dotty.tools.dotc.core.TypeComparer.compareNamed$1(TypeComparer.scala:318)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:357)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1595)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:229)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:239)
        at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:147)
        at dotty.tools.dotc.core.TypeComparer.necessarySubType(TypeComparer.scala:158)
        at dotty.tools.dotc.core.TypeComparer$.necessarySubType(TypeComparer.scala:3369)
        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.ProtoTypes$NoViewsAllowed$.necessarilyCompatible(ProtoTypes.scala:168)
        at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:111)
        at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult$(ProtoTypes.scala:32)
        at dotty.tools.dotc.typer.ProtoTypes$NoViewsAllowed$.constrainResult(ProtoTypes.scala:168)
        at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:162)
        at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult$(ProtoTypes.scala:32)
        at dotty.tools.dotc.typer.ProtoTypes$NoViewsAllowed$.constrainResult(ProtoTypes.scala:168)
        at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:567)
        at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:887)
        at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:1011)
        at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1275)
        at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:434)
        at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:151)
        at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:1084)
        at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$2(Applications.scala:1194)
        at dotty.tools.dotc.typer.Typer$.tryEither(Typer.scala:124)
        at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1209)
        at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1249)
        at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:434)
        at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:151)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3506)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3591)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3668)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3672)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3783)
        at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:2841)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3485)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3590)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3668)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3672)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3694)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3740)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3170)
        at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3494)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3498)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3590)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3668)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3672)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3694)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3740)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3303)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3540)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3591)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3668)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3672)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3783)
        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:507)
        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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions