Skip to content

Crash with "invalid prefix NoType" #7822

Closed
@LPTK

Description

@LPTK

minimized code

class Code {
  type Ctx
}
def foo(o0:Code,o1:Code) = new Code { type Ctx = o0.Ctx & o1.Ctx }  
def foo0(o0:Code,o1:Code): Code { type Ctx = o0.Ctx & o1.Ctx } = foo(o0,o1)

https://scastie.scala-lang.org/HFcd0ggAQHaqDFjRSpxEhw

Stack trace
java.lang.AssertionError: assertion failed: invalid prefix NoType

java.lang.AssertionError: assertion failed: invalid prefix NoType
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.core.Types$NamedType.<init>(Types.scala:1780)
	at dotty.tools.dotc.core.Types$TypeRef.<init>(Types.scala:2327)
	at dotty.tools.dotc.core.Types$CachedTypeRef.<init>(Types.scala:2356)
	at dotty.tools.dotc.core.Uniques$NamedTypeUniques.newType$1(Uniques.scala:64)
	at dotty.tools.dotc.core.Uniques$NamedTypeUniques.enterIfNew(Uniques.scala:68)
	at dotty.tools.dotc.core.Types$TypeRef$.apply(Types.scala:2412)
	at dotty.tools.dotc.core.Types$TypeRef$.apply(Types.scala:2418)
	at dotty.tools.dotc.core.Types$NamedType$.apply(Types.scala:2392)
	at dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2247)
	at dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2254)
	at dotty.tools.dotc.core.TypeComparer.liftToThis(TypeComparer.scala:1111)
	at dotty.tools.dotc.core.TypeComparer.tryLiftedToThis1$1(TypeComparer.scala:1053)
	at dotty.tools.dotc.core.TypeComparer.fourthTry$1(TypeComparer.scala:724)
	at dotty.tools.dotc.core.TypeComparer.thirdTryNamed$1(TypeComparer.scala:466)
	at dotty.tools.dotc.core.TypeComparer.compareNamed$1(TypeComparer.scala:265)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:280)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1071)
	at dotty.tools.dotc.core.TypeComparer.fourthTry$2$$anonfun$1(TypeComparer.scala:790)
	at dotty.runtime.function.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
	at dotty.tools.dotc.core.TypeComparer.sufficientEither(TypeComparer.scala:1345)
	at dotty.tools.dotc.core.TypeComparer.either(TypeComparer.scala:1306)
	at dotty.tools.dotc.core.TypeComparer.fourthTry$1(TypeComparer.scala:790)
	at dotty.tools.dotc.core.TypeComparer.thirdTryNamed$1(TypeComparer.scala:466)
	at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:496)
	at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:417)
	at dotty.tools.dotc.core.TypeComparer.compareNamed$1(TypeComparer.scala:276)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:280)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1071)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:326)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1071)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:160)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:170)
	at dotty.tools.dotc.core.TypeComparer.compareTypeBounds$1(TypeComparer.scala:680)
	at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:686)
	at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:444)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:355)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1071)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:160)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:170)
	at dotty.tools.dotc.core.TypeComparer.hasSubRefinement$1(TypeComparer.scala:1519)
	at dotty.tools.dotc.core.TypeComparer.isSubRefinements(TypeComparer.scala:1525)
	at dotty.tools.dotc.core.TypeComparer.compareRefined$1(TypeComparer.scala:544)
	at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:547)
	at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:444)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:355)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1071)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:160)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:170)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:127)
	at dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:853)
	at dotty.tools.dotc.core.Types$Type.relaxed_$less$colon$less(Types.scala:887)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.isCompatible(ProtoTypes.scala:37)
	at dotty.tools.dotc.typer.Typer.isCompatible(Typer.scala:83)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:79)
	at dotty.tools.dotc.typer.Typer.constrainResult(Typer.scala:83)
	at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:100)
	at dotty.tools.dotc.typer.Typer.constrainResult(Typer.scala:83)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:344)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:692)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:794)
	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:867)
	at dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:920)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2248)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:931)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:966)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2060)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2116)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2152)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2164)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2240)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1604)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2047)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2115)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2152)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2164)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2183)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2227)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1731)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2050)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2115)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2152)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2164)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2183)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2227)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1852)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2091)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2116)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2152)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2164)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2240)
	at dotty.tools.dotc.typer.FrontEnd.liftedTree9$2(FrontEnd.scala:78)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:83)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:84)
	at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:114)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:305)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:162)
	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:172)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:180)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:65)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:187)
	at dotty.tools.dotc.Run.compileSources(Run.scala:124)
	at dotty.tools.dotc.Run.compile(Run.scala:107)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:36)
	at dotty.tools.dotc.Driver.process(Driver.scala:189)
	at dotty.tools.dotc.Main.process(Main.scala)
	at xsbt.CachedCompilerImpl.run(CachedCompilerImpl.java:69)
	at xsbt.CompilerInterface.run(CompilerInterface.java:41)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:248)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:122)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:95)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:91)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:186)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3$adapted(MixedAnalyzingCompiler.scala:77)
	at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:215)
	at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:77)
	at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:146)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:343)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:343)
	at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:120)
	at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:100)
	at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:180)
	at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:98)
	at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:102)
	at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:155)
	at sbt.internal.inc.Incremental$.compile(Incremental.scala:92)
	at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:75)
	at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:348)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:301)
	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:168)
	at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:248)
	at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:74)
	at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1761)
	at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1734)
	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
	at sbt.std.Transform$$anon$4.work(Transform.scala:67)
	at sbt.Execute.$anonfun$submit$2(Execute.scala:281)
	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
	at sbt.Execute.work(Execute.scala:290)
	at sbt.Execute.$anonfun$submit$1(Execute.scala:281)
	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions