-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Milestone
Description
Compiler version
Scala code runner version 3.0.1 -- Copyright 2002-2021, LAMP/EPFL
Minimized code
I was just randomly messing around with polymorphic functions when I found that the following code causes a crash:
scala> val f = [R] => () => [A] => (a: A => R, b: A) => a(b)
val f: PolyFunction{apply: [R](): PolyFunction{apply: [A](a: A => R, b: A): R}} = <function0>
scala> f[Int]()(_, 3)
Output (click arrow to expand)
exception while typing f.apply[Int]().apply of class class dotty.tools.dotc.ast.Trees$Select # -1
exception while typing f.apply[Int]().apply[Any] of class class dotty.tools.dotc.ast.Trees$TypeApply #
-1
exception while typing f.apply[Int]().apply[Any](_$1, 3) of class class dotty.tools.dotc.ast.Trees$App
ly # -1
exception while typing def $anonfun(_$1: Any => Int): Int = f.apply[Int]().apply[Any](_$1, 3) of class
class dotty.tools.dotc.ast.Trees$DefDef # -1
exception while typing {
def $anonfun(_$1: Any => Int): Int = f.apply[Int]().apply[Any](_$1, 3)
closure($anonfun)
} of class class dotty.tools.dotc.ast.Trees$Block # -1
exception while typing def res0: (Any => Int) => Int =
{
def $anonfun(_$1: Any => Int): Int = f.apply[Int]().apply[Any](_$1, 3)
closure($anonfun)
} of class class dotty.tools.dotc.ast.Trees$DefDef # -1
exception while typing @scala.annotation.internal.SourceFile("rs$line$2") final module class rs$line$2
$
()
extends Object() {
private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[repl$.rs$line$2.type])
def res0: (Any => Int) => Int =
{
def $anonfun(_$1: Any => Int): Int = f.apply[Int]().apply[Any](_$1, 3)
closure($anonfun)
}
} of class class dotty.tools.dotc.ast.Trees$TypeDef # -1
exception while typing package repl$ {
final lazy module val rs$line$2: repl$.rs$line$2$ = new repl$.rs$line$2$()
@scala.annotation.internal.SourceFile("rs$line$2") final module class
rs$line$2$
() extends Object() {
private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[repl$.rs$line$2.type])
def res0: (Any => Int) => Int =
{
def $anonfun(_$1: Any => Int): Int = f.apply[Int]().apply[Any](_$1, 3)
closure($anonfun)
}
}
} of class class dotty.tools.dotc.ast.Trees$PackageDef # -1
Exception in thread "main" java.lang.AssertionError: assertion failed: <none>
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.transform.Erasure$Typer.typedSelect(Erasure.scala:721)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2665)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2757)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2943)
at dotty.tools.dotc.transform.Erasure$Typer.typedTypeApply(Erasure.scala:815)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2714)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2758)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2943)
at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:837)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2695)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2758)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2943)
at dotty.tools.dotc.typer.Typer.$anonfun$34(Typer.scala:2168)
at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:225)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2168)
at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:955)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2672)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2757)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2849)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2899)
at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1053)
at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1023)
at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1027)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2703)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2758)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2943)
at dotty.tools.dotc.typer.Typer.$anonfun$34(Typer.scala:2168)
at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:225)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2168)
at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:955)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2672)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2757)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2849)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2899)
at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1053)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2354)
at dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1043)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2683)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2687)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2757)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2849)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2899)
at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1053)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2477)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2728)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2758)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2823)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2827)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2943)
at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:132)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:303)
at scala.collection.immutable.List.map(List.scala:246)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:304)
at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:205)
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$5(Run.scala:216)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:224)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
at dotty.tools.dotc.Run.compileUnits(Run.scala:231)
at dotty.tools.dotc.Run.compileUnits(Run.scala:172)
at dotty.tools.repl.ReplCompiler.runCompilationUnit(ReplCompiler.scala:152)
at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:162)
at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:249)
at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:212)
at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:146)
at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:149)
at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:168)
at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:149)
at dotty.tools.repl.ReplDriver.tryRunning(ReplDriver.scala:115)
at dotty.tools.repl.Main$.main(Main.scala:6)
at dotty.tools.repl.Main.main(Main.scala)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at coursier.bootstrap.launcher.a.a(Unknown Source)
at coursier.bootstrap.launcher.Launcher.main(Unknown Source)