Skip to content

Crash in ExplicitOuter involving compiler-generated ordinal method in companion of inner sealed class #10769

Closed
@TimWSpence

Description

@TimWSpence

Minimzed from TimWSpence/cats-stm#196

Minimized code

package stm

trait STMLike[F[_]] {
  import Internals._

  sealed abstract class Txn[+A] {}

  object Txn {
    def abort[A](e: Throwable): Txn[A] = Abort(e)
  }

  object Internals {
    case class Abort(error: Throwable) extends Txn[Nothing]
  }

}

Output (click arrow to expand)

-- [E029] Pattern Match Exhaustivity Warning: try/i10769.scala:8:9 -------------
8 |  object Txn {
  |         ^
  |         match may not be exhaustive.
  |
  |         It would fail on pattern case: Internals.Abort(_)

longer explanation available when compiling with `-explain`
exception while typing Internals$.this of class class dotty.tools.dotc.ast.Trees$This # -1
exception while typing x1.$asInstanceOf$[stm.STMLike.Internals.Abort].
  stm$STMLike$Internals$Abort$$$outer
.eq(Internals$.this) of class class dotty.tools.dotc.ast.Trees$Apply # -1
exception while typing x1.$isInstanceOf$[stm.STMLike.Internals.Abort].&&(
  x1.$asInstanceOf$[stm.STMLike.Internals.Abort].
    stm$STMLike$Internals$Abort$$$outer
  .eq(Internals$.this)
) of class class dotty.tools.dotc.ast.Trees$Apply # -1
exception while typing if 
  x1.$isInstanceOf$[stm.STMLike.Internals.Abort].&&(
    x1.$asInstanceOf$[stm.STMLike.Internals.Abort].
      stm$STMLike$Internals$Abort$$$outer
    .eq(Internals$.this)
  )
 then return[matchResult1] 0 else () of class class dotty.tools.dotc.ast.Trees$If # -1
[...]

Exception in thread "main" java.lang.AssertionError: assertion failed: failure to construct path from method ordinal/object Txn/trait STMLike/package stm/package <root> to `this` of object Internals in trait STMLike;
trait STMLike in package stm does not have an outer accessor while compiling try/i10769.scala
java.lang.AssertionError: assertion failed: failure to construct path from method ordinal/object Txn/trait STMLike/package stm/package <root> to `this` of object Internals in trait STMLike;
trait STMLike in package stm does not have an outer accessor
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
        at dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.loop$1(ExplicitOuter.scala:410)
        at dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.path$extension(ExplicitOuter.scala:429)
        at dotty.tools.dotc.transform.Erasure$Typer.typedThis(Erasure.scala:747)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2490)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2551)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:125)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2620)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2624)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2740)
        at dotty.tools.dotc.transform.Erasure$Typer.$anonfun$4(Erasure.scala:792)
        at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:149)
        at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:792)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2489)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2551)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:125)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2620)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2624)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2740)
        at dotty.tools.dotc.transform.Erasure$Typer.$anonfun$4(Erasure.scala:792)
        at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:149)
        at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:792)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2489)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2551)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:125)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2620)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2624)
        at dotty.tools.dotc.typer.Typer.typedIf(Typer.scala:960)
        at dotty.tools.dotc.transform.Erasure$Typer.typedIf(Erasure.scala:826)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2498)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2551)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:125)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2620)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2624)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2673)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2696)
        at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:984)
        at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:906)
        at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:910)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2497)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2551)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:125)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2620)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2624)
        at dotty.tools.dotc.typer.Typer.typedLabeled(Typer.scala:1483)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2482)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2550)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:125)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2620)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2624)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2740)
        at dotty.tools.dotc.typer.Typer.$anonfun$33(Typer.scala:1995)
        at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:216)
        at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1995)
        at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:893)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2466)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2550)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:125)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2620)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2624)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2646)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2696)
        at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:984)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2139)
        at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2477)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2481)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2550)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:125)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2620)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2624)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2646)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2696)
        at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:984)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2139)
        at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2477)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2481)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2550)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:125)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2620)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2624)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2646)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2696)
        at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:984)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2274)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2522)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2551)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:125)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2620)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2624)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2740)
        at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:123)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:296)
        at scala.collection.immutable.List.map(List.scala:246)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:297)
        at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:185)
        at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at dotty.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:195)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:203)
        at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:210)
        at dotty.tools.dotc.Run.compileSources(Run.scala:147)
        at dotty.tools.dotc.Run.compile(Run.scala:129)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
        at dotty.tools.dotc.Driver.process(Driver.scala:193)
        at dotty.tools.dotc.Driver.process(Driver.scala:162)
        at dotty.tools.dotc.Driver.process(Driver.scala:174)
        at dotty.tools.dotc.Driver.main(Driver.scala:201)
        at dotty.tools.dotc.Main.main(Main.scala)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions