Closed
Description
minimized code
trait Instrument {
type R
def result: R
}
trait InstrumentFactory[I <: Instrument] {
def createInstrument: I
}
case class Instrumented[I <: Instrument](
instrumentation: I#R)
def instrumented[D, I <: Instrument](instrumentFactory: InstrumentFactory[I]): Instrumented[I] = {
val instrument = instrumentFactory.createInstrument
Instrumented(instrument.result)
}
Stack trace
assertion failure for (instrument.result : => instrument.R) <:< I#R, frozen = false
[info] exception occurred while typechecking E:\prog\dotty\dotty-bugs\0\src\main\scala\bug.scala
[info] exception occurred while compiling E:\prog\dotty\dotty-bugs\0\src\main\scala\bug.scala
java.lang.AssertionError: assertion failed: invalid prefix NoType while compiling E:\prog\dotty\dotty-bugs\0\src\main\scala\bug.scala
[error] ## Exception when compiling 1 sources to E:\prog\dotty\dotty-bugs\0\target\scala-0.21\classes
[error] java.lang.AssertionError: assertion failed: invalid prefix NoType
[error] dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
[error] dotty.tools.dotc.core.Types$NamedType.<init>(Types.scala:1835)
[error] dotty.tools.dotc.core.Types$TypeRef.<init>(Types.scala:2382)
[error] dotty.tools.dotc.core.Types$CachedTypeRef.<init>(Types.scala:2411)
[error] dotty.tools.dotc.core.Uniques$NamedTypeUniques.newType$1(Uniques.scala:64)
[error] dotty.tools.dotc.core.Uniques$NamedTypeUniques.enterIfNew(Uniques.scala:68)
[error] dotty.tools.dotc.core.Types$TypeRef$.apply(Types.scala:2467)
[error] dotty.tools.dotc.core.Types$TypeRef$.apply(Types.scala:2473)
[error] dotty.tools.dotc.core.Types$NamedType$.apply(Types.scala:2447)
[error] dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2302)
[error] dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2309)
[error] dotty.tools.dotc.core.TypeComparer.liftToThis(TypeComparer.scala:1117)
[error] dotty.tools.dotc.core.TypeComparer.tryLiftedToThis2$1(TypeComparer.scala:1064)
[error] dotty.tools.dotc.core.TypeComparer.thirdTryNamed$1(TypeComparer.scala:467)
[error] dotty.tools.dotc.core.TypeComparer.compareNamed$1(TypeComparer.scala:275)
[error] dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:281)
[error] dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1077)
[error] dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:161)
[error] dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:171)
[error] dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:128)
[error] dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:892)
[error] dotty.tools.dotc.typer.Typer.adaptNoArgsOther$6(Typer.scala:2864)
[error] dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:2933)
[error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3139)
[error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2544)
[error] dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:340)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:797)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:797)
[error] dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:533)
[error] dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:602)
[error] dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:354)
[error] dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:694)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:796)
[error] dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:870)
[error] dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:924)
[error] dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2341)
[error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:935)
[error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:970)
[error] dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2119)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2177)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2333)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:790)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2127)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2177)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2333)
[error] dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1653)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2106)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2176)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2247)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2291)
[error] dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1784)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2109)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2176)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2247)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2291)
[error] dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1910)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2150)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2177)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2333)
[error] dotty.tools.dotc.typer.FrontEnd.liftedTree1$2(FrontEnd.scala:78)
[error] dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:83)
[error] dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
[error] dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:84)
[error] dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:114)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:305)
[error] dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
[error] dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:161)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error] dotty.tools.dotc.Run.runPhases$5(Run.scala:171)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:179)
[error] dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:65)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:186)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:123)
[error] dotty.tools.dotc.Run.compile(Run.scala:106)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:36)
[error] dotty.tools.dotc.Driver.process(Driver.scala:189)
[error] dotty.tools.dotc.Main.process(Main.scala)
[error] xsbt.CachedCompilerImpl.run(CachedCompilerImpl.java:69)
[error] xsbt.CompilerInterface.run(CompilerInterface.java:41)
[error] sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] java.lang.reflect.Method.invoke(Method.java:498)
[error] sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:248)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:122)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:95)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:91)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:186)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3$adapted(MixedAnalyzingCompiler.scala:77)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:215)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:77)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:146)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:343)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:343)
[error] sbt.internal.inc.Incremental$.doCompile(Incremental.scala:120)
[error] sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:100)
[error] sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:180)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:98)
[error] sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:102)
[error] sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:155)
[error] sbt.internal.inc.Incremental$.compile(Incremental.scala:92)
[error] sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:75)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:348)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:301)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:168)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:248)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:74)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1762)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1735)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:67)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:281)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
[error] sbt.Execute.work(Execute.scala:290)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:281)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] java.lang.Thread.run(Thread.java:748)```