Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deriving ReadWriter for inner sealed trait hierarchy with default values crashes compiler #594

Open
uosis opened this issue Jun 30, 2024 · 0 comments

Comments

@uosis
Copy link

uosis commented Jun 30, 2024

Given this class:

class A {
  sealed trait T derives upickle.default.ReadWriter
  case class C(v: Int = 1) extends T
}

Results in this compiler crash:

  exception while retyping C.this of class This # -1

  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 -Yno-enrich-error-messages.

     while compiling: cmd1.sc
        during phase: MegaPhase{elimErasedValueType, pureStats, vcElideAllocations, etaReduce, arrayApply, elimPolyFunction, tailrec, completeJavaEnums, mixin, lazyVals, memoize, nonLocalReturns, capturedVars}
                mode: Mode(ImplicitsEnabled,ReadPositions,Interactive)
     library version: version 2.13.14
    compiler version: version 3.4.2
            settings: -Ycook-docs true -color never -d (memory) -deprecation true -feature true

java.lang.AssertionError: assertion failed: failure to construct path from method storeDefaults/anonymous class ReadersVersionSpecific.this.CaseClassReadereader {...}/value reader/getter x0/getter derived$ReadWriter/object T/class A/object cmd1/package ammonite.$sess/package ammonite/package <root> to `this` of object C in class A;
class A in object cmd1 does not have an outer accessor
  scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
  dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.loop$1(ExplicitOuter.scala:478)
  dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.path$extension(ExplicitOuter.scala:482)
  dotty.tools.dotc.transform.Erasure$Typer.typedThis(Erasure.scala:804)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3138)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3295)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.transform.Erasure$Typer.typedSelect(Erasure.scala:671)
  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3112)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.ReTyper.typedInlined(ReTyper.scala:100)
  dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:904)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3160)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
  dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:856)
  dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:160)
  dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:856)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3137)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.transform.Erasure$Typer.typedSelect(Erasure.scala:671)
  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3112)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
  dotty.tools.dotc.transform.Erasure$Typer.typedTypeApply(Erasure.scala:816)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3157)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.ReTyper.typedInlined(ReTyper.scala:100)
  dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:904)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3160)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.ReTyper.typedInlined(ReTyper.scala:100)
  dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:904)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3160)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
  dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:856)
  dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:160)
  dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:161)
  dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:856)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3137)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.ReTyper.typedInlined(ReTyper.scala:100)
  dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:904)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3160)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3295)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3351)
  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
  dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1073)
  dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1209)
  dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1213)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3145)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3295)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.transform.Erasure$Typer.typedTyped(Erasure.scala:627)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3142)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3295)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.ReTyper.typedInlined(ReTyper.scala:100)
  dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:904)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3160)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
  dotty.tools.dotc.typer.Typer.$anonfun$63(Typer.scala:2627)
  dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
  dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2627)
  dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:960)
  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3119)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3324)
  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
  dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1073)
  dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2814)
  dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1049)
  dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3125)
  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3129)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3324)
  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
  dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1073)
  dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1209)
  dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1213)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3145)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
  dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:2564)
  dotty.tools.dotc.transform.Erasure$Typer.typedValDef(Erasure.scala:913)
  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3116)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3324)
  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
  dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1073)
  dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1209)
  dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1213)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3145)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.transform.Erasure$Typer.typedTyped(Erasure.scala:633)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3142)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3295)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.ReTyper.typedInlined(ReTyper.scala:100)
  dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:904)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3160)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
  dotty.tools.dotc.typer.Typer.$anonfun$63(Typer.scala:2627)
  dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
  dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2627)
  dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:960)
  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3119)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3324)
  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
  dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1073)
  dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1209)
  dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1213)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3145)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3295)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.transform.Erasure$Typer.typedTyped(Erasure.scala:633)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3142)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3295)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.ReTyper.typedInlined(ReTyper.scala:100)
  dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:904)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3160)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
  dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1216)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3145)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.transform.Erasure$Typer.typedTyped(Erasure.scala:633)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3142)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3295)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.ReTyper.typedInlined(ReTyper.scala:100)
  dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:904)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3160)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
  dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:856)
  dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:160)
  dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:856)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3137)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.transform.Erasure$Typer.typedTyped(Erasure.scala:633)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3142)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.ReTyper.typedInlined(ReTyper.scala:100)
  dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:904)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3160)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.transform.Erasure$Typer.typedTyped(Erasure.scala:633)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3142)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3295)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.ReTyper.typedInlined(ReTyper.scala:100)
  dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:904)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3160)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
  dotty.tools.dotc.typer.Typer.$anonfun$63(Typer.scala:2627)
  dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
  dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2627)
  dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:960)
  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3119)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3324)
  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
  dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1073)
  dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2814)
  dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1049)
  dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3125)
  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3129)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3324)
  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
  dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1073)
  dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2814)
  dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1049)
  dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3125)
  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3129)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3324)
  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
  dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1073)
  dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2814)
  dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1049)
  dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3125)
  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3129)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3220)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3324)
  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
  dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1073)
  dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2947)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3171)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3351)
  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3370)
  dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1073)
  dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2947)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3171)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3221)
  dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3298)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3302)
  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3413)
  dotty.tools.dotc.transform.Erasure.run(Erasure.scala:144)
  dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:354)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  scala.collection.immutable.List.foreach(List.scala:334)
  dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:360)
  dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:315)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
  dotty.tools.dotc.Run.runPhases$1(Run.scala:337)
  dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:350)
  dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:360)
  dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
  dotty.tools.dotc.Run.compileUnits(Run.scala:360)
  dotty.tools.dotc.Run.compileUnits(Run.scala:267)
  ammonite.compiler.Compiler.compile(Compiler.scala:233)
  ammonite.compiler.CompilerLifecycleManager.compileClass(CompilerLifecycleManager.scala:132)
  ammonite.interp.Interpreter.evaluateLine$$anonfun$1(Interpreter.scala:290)
  ammonite.util.Catching.flatMap(Res.scala:110)
  ammonite.interp.Interpreter.evaluateLine(Interpreter.scala:305)
  ammonite.interp.Interpreter.processLine$$anonfun$1$$anonfun$1$$anonfun$2(Interpreter.scala:272)
  ammonite.util.Res$Success.flatMap(Res.scala:58)
  ammonite.interp.Interpreter.processLine$$anonfun$1$$anonfun$1(Interpreter.scala:274)
  ammonite.util.Res$Success.flatMap(Res.scala:58)
  ammonite.interp.Interpreter.processLine$$anonfun$1(Interpreter.scala:274)
  ammonite.util.Catching.flatMap(Res.scala:110)
  ammonite.interp.Interpreter.processLine(Interpreter.scala:274)
  ammonite.repl.Repl.action$$anonfun$2$$anonfun$2$$anonfun$3(Repl.scala:207)
  ammonite.util.Res$Success.flatMap(Res.scala:58)
  ammonite.repl.Repl.action$$anonfun$2$$anonfun$2(Repl.scala:211)
  ammonite.repl.Scoped.flatMap$$anonfun$1(Signaller.scala:45)
  ammonite.repl.Signaller.apply(Signaller.scala:28)
  ammonite.repl.Scoped.flatMap(Signaller.scala:45)
  ammonite.repl.Scoped.flatMap$(Signaller.scala:42)
  ammonite.repl.Signaller.flatMap(Signaller.scala:16)
  ammonite.repl.Repl.action$$anonfun$2(Repl.scala:211)
  ammonite.util.Res$Success.flatMap(Res.scala:58)
  ammonite.repl.Repl.action(Repl.scala:211)
  ammonite.repl.Repl.loop$1(Repl.scala:218)
  ammonite.repl.Repl.run(Repl.scala:233)
  ammonite.Main.run(Main.scala:249)
  ammonite.MainRunner.runRepl$$anonfun$1(MainRunner.scala:76)
  ammonite.MainRunner.watchLoop(MainRunner.scala:57)
  ammonite.MainRunner.runRepl(MainRunner.scala:76)
  ammonite.AmmoniteMain$.main0(AmmoniteMain.scala:98)
  ammonite.AmmoniteMain$.main(AmmoniteMain.scala:31)
  ammonite.AmmoniteMain.main(AmmoniteMain.scala)

Any of the following changes fix the crash:

  • removing default value from v
  • changing class A to object A
  • removing trait and deriving case class directly

Possibly a Scala bug similar to this: scala/scala3#11174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant