You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//>usingscala3.nightly// if we removed `extends AnyVal` it worksclassInner(body: Int?=>Int) extendsAnyVal:// this needs to be context function to makes compiler crashesdefrescue:Int?=>Int=???
Output (click arrow to expand)
unhandled exception while running erasure on {retracted}/compiler-crash.scala
while compiling: {retracted}/scripts/compiler-crash.scala
during phase: erasure
mode: Mode(ImplicitsEnabled)
library version: version 2.13.16
compiler version: version 3.7.0-RC1-bin-20250308-133dcb3-NIGHTLY-git-133dcb3
settings: -classpath {retracted}/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.7.0-RC1-bin-20250308-133dcb3-NIGHTLY/scala3-library_3-3.7.0-RC1-bin-20250308-133dcb3-NIGHTLY.jar:{retracted}/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.16/scala-library-2.13.16.jar -d /{retracted}/.scala-build/scripts_84160669fb-59de36a8e6/classes/main -sourceroot {retracted}/scripts
Exception in thread "main" scala.MatchError: Apply(Ident(rescue$extension),List(This(Ident(Inner)))) (of class dotty.tools.dotc.ast.Trees$Apply)
at dotty.tools.dotc.transform.Erasure$Typer.skipContextClosures$1(Erasure.scala:952)
at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:954)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3555)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3657)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3735)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3740)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3762)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3808)
at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1085)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3236)
at dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1061)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3561)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3565)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3657)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3735)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3740)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3762)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3808)
at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1085)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3369)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3607)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3658)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3735)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3740)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3851)
at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:145)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:383)
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:376)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:346)
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:339)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:386)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:386)
at scala.Function0.apply$mcV$sp(Function0.scala:42)
at dotty.tools.dotc.Run.showProgress(Run.scala:448)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:386)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:398)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
at dotty.tools.dotc.Run.compileUnits(Run.scala:398)
at dotty.tools.dotc.Run.compileSources(Run.scala:285)
at dotty.tools.dotc.Run.compile(Run.scala:270)
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.dotc.Main.mai
The text was updated successfully, but these errors were encountered:
We should probably forbid value classes for context-function types in the first place. That's not what the mechanism is designed for. Crashing over this is of course not good and requires fixing regardless.
Compiler version
I tried with 3.3.0, 3.3.5, 3.6.4 and 3.nightly
Minimized code
Output (click arrow to expand)
unhandled exception while running erasure on {retracted}/compiler-crash.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.
Exception in thread "main" scala.MatchError: Apply(Ident(rescue$extension),List(This(Ident(Inner)))) (of class dotty.tools.dotc.ast.Trees$Apply)
at dotty.tools.dotc.transform.Erasure$Typer.skipContextClosures$1(Erasure.scala:952)
at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:954)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3555)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3657)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3735)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3740)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3762)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3808)
at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1085)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3236)
at dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1061)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3561)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3565)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3657)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3735)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3740)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3762)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3808)
at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1085)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3369)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3607)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3658)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3735)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3740)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3851)
at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:145)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:383)
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:376)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:346)
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:339)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:386)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:386)
at scala.Function0.apply$mcV$sp(Function0.scala:42)
at dotty.tools.dotc.Run.showProgress(Run.scala:448)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:386)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:398)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
at dotty.tools.dotc.Run.compileUnits(Run.scala:398)
at dotty.tools.dotc.Run.compileSources(Run.scala:285)
at dotty.tools.dotc.Run.compile(Run.scala:270)
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.dotc.Main.mai
The text was updated successfully, but these errors were encountered: