Closed
Description
Compiler version
If you're not sure what version you're using, run print scalaVersion
from sbt
(if you're running scalac manually, use scalac -version
instead).
Minimized code
class Foo:
object Bar
object Baz:
def f(x: Any): Unit =
x match
case s: (Bar.type & x.type) =>
Output (click arrow to expand)
exception while typing Foo.this of class class dotty.tools.dotc.ast.Trees$This # -1
exception while typing Foo.this.Bar of class class dotty.tools.dotc.ast.Trees$Select # -1
exception while typing x1.$asInstanceOf$[Object].eq(Foo.this.Bar) of class class dotty.tools.dotc.ast.Trees$Apply # -1
exception while typing x1.$asInstanceOf$[Object].eq(Foo.this.Bar).&& of class class dotty.tools.dotc.ast.Trees$Select # -1
exception while typing x1.$asInstanceOf$[Object].eq(Foo.this.Bar).&&(x.==(x1)) of class class dotty.tools.dotc.ast.Trees$Apply # -1
exception while typing x1.$isInstanceOf$[Foo.this.Bar.type & (x : Object)] of class class dotty.tools.dotc.ast.Trees$TypeApply # -1
exception while typing if x1.$isInstanceOf$[Foo.this.Bar.type & (x : Object)] then
{
case val s: Foo.this.Bar.type & (x : Object) =
x1.$asInstanceOf$[Foo.this.Bar.type & (x : Object)]
return[matchResult1]
{
()
}
}
else () of class class dotty.tools.dotc.ast.Trees$If # -1
exception occurred while compiling bug.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: asTerm called on not-a-Term val <none>
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.core.Symbols$Symbol.asTerm(Symbols.scala:163)
at dotty.tools.dotc.transform.ExplicitOuter$.dotty$tools$dotc$transform$ExplicitOuter$$$outerParamAccessor(ExplicitOuter.scala:230)
at dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.loop$1(ExplicitOuter.scala:424)
at dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.path$extension(ExplicitOuter.scala:433)
at dotty.tools.dotc.transform.Erasure$Typer.typedThis(Erasure.scala:805)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2696)
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.transform.Erasure$Typer.typedSelect(Erasure.scala:696)
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.$anonfun$4(Erasure.scala:850)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:153)
at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:850)
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.transform.Erasure$Typer.typedSelect(Erasure.scala:696)
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.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.transexception while typing {
case val x1: (x : Object) = x
if x1.$isInstanceOf$[Foo.this.Bar.type & (x : Object)] then
{
case val s: Foo.this.Bar.type & (x : Object) =
x1.$asInstanceOf$[Foo.this.Bar.type & (x : Object)]
return[matchResult1]
{
()
}
}
else ()
throw new MatchError(x1)
} of class class dotty.tools.dotc.ast.Trees$Block # -1
exception while typing matchResult1[Unit]:
{
case val x1: (x : Object) = x
if x1.$isInstanceOf$[Foo.this.Bar.type & (x : Object)] then
{
case val s: Foo.this.Bar.type & (x : Object) =
x1.$asInstanceOf$[Foo.this.Bar.type & (x : Object)]
return[matchResult1]
{
()
}
}
else ()
throw new MatchError(x1)
} of class class dotty.tools.dotc.ast.Trees$Labeled # -1
exception while typing def unapply(x: Any): Unit =
matchResult1[Unit]:
{
case val x1: (x : Object) = x
if x1.$isInstanceOf$[Foo.this.Bar.type & (x : Object)] then
{
case val s: Foo.this.Bar.type & (x : Object) =
x1.$asInstanceOf$[Foo.this.Bar.type & (x : Object)]
return[matchResult1]
{
()
}
}
else ()
throw new MatchError(x1)
} of class class dotty.tools.dotc.ast.Trees$DefDef # -1
exception while typing final module class Baz$() extends Object() {
def unapply(x: Any): Unit =
matchResult1[Unit]:
{
case val x1: (x : Object) = x
if x1.$isInstanceOf$[Foo.this.Bar.type & (x : Object)] then
{
case val s: Foo.this.Bar.type & (x : Object) =
x1.$asInstanceOf$[Foo.this.Bar.type & (x : Object)]
return[matchResult1]
{
()
}
}
else ()
throw new MatchError(x1)
}
} of class class dotty.tools.dotc.ast.Trees$TypeDef # -1
exception while typing @scala.annotation.internal.SourceFile("bug.scala") class Foo() extends Object()
{
final lazy module def Bar: Foo.this.Bar$ = new Foo.this.Bar$()
final module class Bar$() extends Object() {}
final lazy module def Baz: Foo.this.Baz$ = new Foo.this.Baz$()
final module class Baz$() extends Object() {
def unapply(x: Any): Unit =
matchResult1[Unit]:
{
case val x1: (x : Object) = x
if x1.$isInstanceOf$[Foo.this.Bar.type & (x : Object)] then
{
case val s: Foo.this.Bar.type & (x : Object) =
x1.$asInstanceOf$[Foo.this.Bar.type & (x : Object)]
return[matchResult1]
{
()
}
}
else ()
throw new MatchError(x1)
}
}
} of class class dotty.tools.dotc.ast.Trees$TypeDef # -1
exception while typing package <empty> {
@scala.annotation.internal.SourceFile("bug.scala") class Foo() extends Object(
)
{
final lazy module def Bar: Foo.this.Bar$ = new Foo.this.Bar$()
final module class Bar$() extends Object() {}
final lazy module def Baz: Foo.this.Baz$ = new Foo.this.Baz$()
final module class Baz$() extends Object() {
def unapply(x: Any): Unit =
matchResult1[Unit]:
{
case val x1: (x : Object) = x
if x1.$isInstanceOf$[Foo.this.Bar.type & (x : Object)] then
{
case val s: Foo.this.Bar.type & (x : Object) =
x1.$asInstanceOf$[Foo.this.Bar.type & (x : Object)]
return[matchResult1]
{
()
}
}
else ()
throw new MatchError(x1)
}
}
}
} of class class dotty.tools.dotc.ast.Trees$PackageDef # -1
java.lang.AssertionError: assertion failed: asTerm called on not-a-Term val <none> while compiling bug.scala
form.Erasure$Typer.typedTypeApply(Erasure.scala:822)
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.typedIf(Typer.scala:1084)
at dotty.tools.dotc.transform.Erasure$Typer.typedIf(Erasure.scala:884)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2704)
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.traverse$1(Typer.scala:2876)
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.typedLabeled(Typer.scala:1638)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2688)
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.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.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.compileSources(Run.scala:166)
at dotty.tools.dotc.Run.compile(Run.scala:150)
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)