-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
itype:bugitype:crashstat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label
Description
Compiler version
3.8.2
Minimized code
trait A[B[_]]:
type C
def apply[D[_]](other: (a: A[D]) ?=> a.C): Any = ???
apply(())Output (click arrow to expand)
Details
Exception in thread "main" java.lang.AssertionError: assertion failed: `wildApprox` failed to remove uninstantiated D
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:674)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6977)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6977)
at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6904)
at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6978)
at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:682)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6977)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6977)
at dotty.tools.dotc.core.Types$TypeAccumulator.op$proxy28$1(Types.scala:6887)
at dotty.tools.dotc.core.Types$TypeAccumulator.foldArgs$3(Types.scala:6887)
at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6891)
at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6978)
at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:682)
at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:665)
at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:660)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6977)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6977)
at dotty.tools.dotc.typer.ProtoTypes$ViewProto.fold(ProtoTypes.scala:676)
at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6940)
at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6978)
at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:682)
at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.apply(Implicits.scala:688)
at dotty.tools.dotc.typer.ImplicitRunInfo.recur$1(Implicits.scala:764)
at dotty.tools.dotc.typer.ImplicitRunInfo.computeIScope(Implicits.scala:775)
at dotty.tools.dotc.typer.ImplicitRunInfo.implicitScope(Implicits.scala:856)
at dotty.tools.dotc.typer.ImplicitRunInfo.implicitScope$(Implicits.scala:626)
at dotty.tools.dotc.Run.implicitScope(Run.scala:45)
at dotty.tools.dotc.typer.Implicits$ImplicitSearch.implicitScope(Implicits.scala:1809)
at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1691)
at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit$$anonfun$3(Implicits.scala:1778)
at dotty.tools.dotc.typer.Implicits$SearchResult.recoverWith(Implicits.scala:430)
at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1764)
at dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1805)
at dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:1119)
at dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:870)
at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:155)
at dotty.tools.dotc.typer.Implicits.inferView(Implicits.scala:910)
at dotty.tools.dotc.typer.Implicits.inferView$(Implicits.scala:870)
at dotty.tools.dotc.typer.Typer.inferView(Typer.scala:155)
at dotty.tools.dotc.typer.Typer.adaptToSubType$1(Typer.scala:4875)
at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:4685)
at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4765)
at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:5028)
at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:4237)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3857)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3862)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3973)
at dotty.tools.dotc.typer.Typer.$anonfun$69(Typer.scala:3033)
at dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:3033)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3658)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3769)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3857)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3862)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3884)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3930)
at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1516)
at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1520)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3684)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3770)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3857)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3862)
at dotty.tools.dotc.typer.Typer.typedFunctionValue(Typer.scala:2007)
at dotty.tools.dotc.typer.Typer.makeContextualFunction(Typer.scala:3833)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3767)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$7(ProtoTypes.scala:543)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:466)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:545)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:1067)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:1067)
at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:733)
at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:816)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:612)
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:942)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:1066)
at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1364)
at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:472)
at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:155)
at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:1154)
at dotty.tools.dotc.typer.Applications.$anonfun$15(Applications.scala:1270)
at dotty.tools.dotc.typer.Typer$.tryEither(Typer.scala:128)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1289)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1338)
at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:472)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:155)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3676)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3770)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3857)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3862)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3973)
at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1802)
at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1792)
at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1802)
at dotty.tools.dotc.typer.Namer.typedAheadRhs$1$$anonfun$1(Namer.scala:2224)
at dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
at dotty.tools.dotc.typer.Namer.typedAheadRhs$1(Namer.scala:2224)
at dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:2232)
at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:2257)
at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:2258)
at dotty.tools.dotc.typer.Namer.inferredResultType(Namer.scala:2270)
at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1845)
at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1851)
at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:837)
at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:1005)
at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:874)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:175)
at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:403)
at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:3623)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3648)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3769)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3857)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3862)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3884)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3930)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3333)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3664)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3668)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3769)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3857)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3862)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3884)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3930)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3466)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3710)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3770)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3857)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3862)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3973)
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:510)
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:380)
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:1324)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:373)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:420)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:420)
at scala.Function0.apply$mcV$sp(Function0.scala:42)
at dotty.tools.dotc.Run.showProgress(Run.scala:482)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:420)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:432)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
at dotty.tools.dotc.Run.compileUnits(Run.scala:432)
at dotty.tools.dotc.Run.compileUnits(Run.scala:325)
at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:90)
at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:341)
at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:303)
at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:221)
at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:224)
at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:258)
at dotty.tools.repl.ReplDriver.runBody$$anonfun$1(ReplDriver.scala:232)
at dotty.tools.runner.ScalaClassLoader$.asContext(ScalaClassLoader.scala:79)
at dotty.tools.repl.ReplDriver.runBody(ReplDriver.scala:232)
at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:224)
at dotty.tools.repl.ReplDriver.tryRunning(ReplDriver.scala:161)
at dotty.tools.repl.Main$.main(Main.scala:7)
at dotty.tools.repl.Main.main(Main.scala)As noted, this crash happens due to not being able to find an implicit A[D]. If code is structured in a way that type inference can determine D, and A[D] can be found, the code compiles and there's no crash.
trait A[B[_]]:
type C
object A:
given A[Option]:
type C = Option[Int]
def apply[E[_], F](e: E[F])(using a: A[E]): a.C = ???
def apply[D[_]](other: (a: A[D]) ?=> a.C): Any = ???
apply(A(Option(5))) //this compiles with no problem
apply(5) //crash
apply(Option(5)) //crashReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
itype:bugitype:crashstat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label