Closed
Description
Compiler version
Minimized code
type AliasToAnyVal = AnyVal
class Foo(a: Int) extends AliasToAnyVal
Output (click arrow to expand)
scalac anyval.scala
unhandled exception while running erasure on anyval.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: anyval.scala
during phase: erasure
mode: Mode(ImplicitsEnabled)
library version: version 2.13.14
compiler version: version 3.5.0
settings:
Exception in thread "main" java.lang.AssertionError: NoDenotation.owner
at dotty.tools.dotc.core.SymDenotations$NoDenotation$.owner(SymDenotations.scala:2623)
at dotty.tools.dotc.ast.tpd$.ref(tpd.scala:462)
at dotty.tools.dotc.transform.Erasure$Boxing$.wrap$1(Erasure.scala:338)
at dotty.tools.dotc.transform.Erasure$Boxing$.cast(Erasure.scala:366)
at dotty.tools.dotc.transform.Erasure$Boxing$.unbox(Erasure.scala:320)
at dotty.tools.dotc.transform.Erasure$Boxing$.adaptToType(Erasure.scala:403)
at dotty.tools.dotc.transform.Erasure$Typer.adapt(Erasure.scala:1098)
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$Typer.$anonfun$7(Erasure.scala:863)
at dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:160)
at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:863)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3392)
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$Typer.typedApply(Erasure.scala:850)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3392)
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.typer.Typer.$anonfun$64(Typer.scala:2816)
at dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2816)
at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:967)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3374)
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.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)
Notes
The check to determine if a class is a value class doesn't take aliasing into account. See:
scala3/compiler/src/dotty/tools/dotc/ast/Desugar.scala
Lines 597 to 601 in cc38962