Open philwalk opened 4 months ago
Managed to reproduce at 9a5b9b4 with scala3-library
for 3.3.1
directly adding the older scala3-library
to the classpath is essential for reproduction.
exception occurred while typechecking repro.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 -Yno-enrich-error-messages.
while compiling: repro.scala
during phase: typer
mode: Mode(ImplicitsEnabled)
library version: version 2.13.12
compiler version: version 3.5.0-RC1-bin-SNAPSHOT-nonbootstrapped-git-9a5b9b4
settings: -classpath /Users/pchabelski/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.1/scala3-library_3-3.3.1.jar
Exception in thread "main" java.lang.ClassCastException: class dotty.tools.dotc.core.Symbols$NoSymbol$ cannot be cast to class dotty.tools.dotc.core.Symbols$ClassSymbol (dotty.tools.dotc.core.Symbols$NoSymbol$ and dotty.tools.dotc.core.Symbols$ClassSymbol are in unnamed module of loader 'app')
at dotty.tools.dotc.core.Symbols$Symbol.asClass(Symbols.scala:191)
at dotty.tools.dotc.core.Definitions.UnitClass(Definitions.scala:574)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.disregardProto(ProtoTypes.scala:78)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:99)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult$(ProtoTypes.scala:29)
at dotty.tools.dotc.typer.ProtoTypes$NoViewsAllowed$.constrainResult(ProtoTypes.scala:123)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:120)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult$(ProtoTypes.scala:29)
at dotty.tools.dotc.typer.ProtoTypes$NoViewsAllowed$.constrainResult(ProtoTypes.scala:123)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:484)
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:795)
at dotty.tools.dotc.typer.Applications$ApplyToTyped.<init>(Applications.scala:922)
at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1139)
at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:351)
at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:120)
at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:985)
at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$2(Applications.scala:1068)
at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3437)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1079)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1117)
at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:351)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:120)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3137)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:2564)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3116)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3324)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2947)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3171)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
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:480)
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:684)
at scala.collection.immutable.List$.from(List.scala:681)
at scala.collection.IterableOps$WithFilter.map(Iterable.scala:898)
at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:100)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:315)
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:337)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:350)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:360)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
at dotty.tools.dotc.Run.compileUnits(Run.scala:360)
at dotty.tools.dotc.Run.compileSources(Run.scala:261)
at dotty.tools.dotc.Run.compile(Run.scala:246)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
at dotty.tools.dotc.Driver.process(Driver.scala:196)
at dotty.tools.dotc.Driver.process(Driver.scala:164)
at dotty.tools.dotc.Driver.process(Driver.scala:176)
at dotty.tools.dotc.Driver.main(Driver.scala:206)
at dotty.tools.dotc.Main.main(Main.scala)
This makes it a valid bug, the compiler shouldn't crash on this. Although the steps are quite unusual.
Compiler version
This turned out to be a function of the classpath. The minimum classpath for exhibiting the problem contains only the
scala3-library_3-3.3.1.jar
from a previous scala version. This seems less like a bug than an error message that is likely to be confusing.Minimized code
Output (click arrow to expand)