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
Any of the following changes will avoid the crash:
use normal function instead of context function
do not override foo
return 0 instead of calling super.foo
remove class Baz
make Baz a trait
Output (click arrow to expand)
exception while typing def Bar$$super$foo: (String) ?=> Int = super[Foo].foo of class class dotty.tools.dotc.ast.Trees$DefDef # -1
exception while typing @SourceFile("Foo.scala") class Baz() extends Object(), Bar {
def Bar$$super$foo: (String) ?=> Int = super[Foo].foo
} of class class dotty.tools.dotc.ast.Trees$TypeDef # -1
exception while typing package <empty> {
@SourceFile("Foo.scala") trait Foo() extends Object {
@ContextResultCount(1) def foo: (String) ?=> Int =
{
def $anonfun(using evidence$1: String): Int = 0
closure($anonfun)
}
}
@SourceFile("Foo.scala") trait Bar() extends Object, Foo {
def Bar$$super$foo: (String) ?=> Int
@ContextResultCount(1) override def foo: (String) ?=> Int =
{
def $anonfun(using evidence$2: String): Int =
this.Bar$$super$foo.apply(evidence$2)
closure($anonfun)
}
}
@SourceFile("Foo.scala") class Baz() extends Object(), Bar {
def Bar$$super$foo: (String) ?=> Int = super[Foo].foo
}
} of class class dotty.tools.dotc.ast.Trees$PackageDef # -1
exception occurred while compiling Foo.scala
java.lang.AssertionError: assertion failed while compiling Foo.scala
Exception in thread "main" java.lang.AssertionError: assertion failed
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
at dotty.tools.dotc.transform.Erasure$Boxing$.adaptToType(Erasure.scala:387)
at dotty.tools.dotc.transform.Erasure$Typer.adapt(Erasure.scala:1042)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3057)
at dotty.tools.dotc.typer.Typer.$anonfun$47(Typer.scala:2256)
at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:238)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2256)
at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:932)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2786)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2871)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2963)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3013)
at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1030)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2454)
at dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1020)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2797)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2801)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2871)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2963)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3013)
at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1030)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2581)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2842)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2872)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:121)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2937)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2941)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3057)
at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:144)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:308)
at scala.collection.immutable.List.map(List.scala:246)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:309)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:259)
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:1328)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:270)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:278)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
at dotty.tools.dotc.Run.compileUnits(Run.scala:287)
at dotty.tools.dotc.Run.compileSources(Run.scala:220)
at dotty.tools.dotc.Run.compile(Run.scala:204)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
at dotty.tools.dotc.Driver.process(Driver.scala:199)
at dotty.tools.dotc.Driver.process(Driver.scala:167)
at dotty.tools.dotc.Driver.process(Driver.scala:179)
at dotty.tools.dotc.Driver.main(Driver.scala:209)
at dotty.tools.dotc.Main.main(Main.scala)
The text was updated successfully, but these errors were encountered:
Kordyjan
changed the title
Compiler crashes when overriding method returning context function
Regression: Compiler crashes when overriding method returning context function
Apr 22, 2022
After bisecting the nightlies I determined that the change was introduced between 3.1.2-RC1-bin-20211102-82172ed-NIGHTLY and 3.1.2-RC1-bin-20211112-4025951-NIGHTLY (weird that we did not publish nightlies for 10 days).
Compiler version
3.1.2
Minimized code
Any of the following changes will avoid the crash:
foo
0
instead of callingsuper.foo
Baz
Baz
atrait
Output (click arrow to expand)
The text was updated successfully, but these errors were encountered: