Closed
Description
Compiler version
3.5.0, 3.4.3
Minimized code
trait A[T]:
type R = T ?=> Unit
def f: R = ()
class B extends A[Int]:
override def f: R = ()
Output (click arrow to expand)
unhandled exception while running erasure on Bug.scala
An unhandled exception was thrown in the compiler.
Please file a crash report here:
https://github.com/scala/scala3/issues/new/choose
For non-enriched exceptions, compile with -Xno-enrich-error-messages.
while compiling: Bug.scala
during phase: erasure
mode: Mode(ImplicitsEnabled)
library version: version 2.13.14
compiler version: version 3.5.0
settings:
Exception in thread "main" scala.MatchError: TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),class B)),type R) (of class dotty.tools.dotc.core.Types$CachedTypeRef)
at dotty.tools.dotc.transform.ContextFunctionResults$.recur$1(ContextFunctionResults.scala:105)
at dotty.tools.dotc.transform.ContextFunctionResults$.contextFunctionResultTypeAfter(ContextFunctionResults.scala:106)
at dotty.tools.dotc.transform.Bridges.etaExpand$1(Bridges.scala:157)
at dotty.tools.dotc.transform.Bridges.bridgeRhs$1(Bridges.scala:166)
at dotty.tools.dotc.transform.Bridges.addBridge$$anonfun$2(Bridges.scala:168)
at dotty.tools.dotc.ast.tpd$.DefDef(tpd.scala:312)
at dotty.tools.dotc.transform.Bridges.addBridge(Bridges.scala:168)
at dotty.tools.dotc.transform.Bridges.addBridgeIfNeeded(Bridges.scala:94)
at dotty.tools.dotc.transform.Bridges.add(Bridges.scala:178)
at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1078)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3074)
at dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1056)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3380)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3384)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3476)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3554)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3558)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3580)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3626)
at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1080)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3207)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3426)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3477)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3554)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3558)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3669)
at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:145)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:380)
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:334)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:373)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
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:1323)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:384)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:396)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
at dotty.tools.dotc.Run.compileUnits(Run.scala:396)
at dotty.tools.dotc.Run.compileSources(Run.scala:282)
at dotty.tools.dotc.Run.compile(Run.scala:267)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
at dotty.tools.dotc.Driver.process(Driver.scala:201)
at dotty.tools.dotc.Driver.process(Driver.scala:169)
at dotty.tools.dotc.Driver.process(Driver.scala:181)
at dotty.tools.dotc.Driver.main(Driver.scala:211)
at dotty.tools.MainGenericCompiler$.run$1(MainGenericCompiler.scala:162)
at dotty.tools.MainGenericCompiler$.main(MainGenericCompiler.scala:186)
at dotty.tools.MainGenericCompiler.main(MainGenericCompiler.scala)