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

Crash during Erasure: assertion failed: missing outer accessor in object Main #19534

Closed
lihaoyi opened this issue Jan 26, 2024 · 4 comments
Closed
Assignees
Labels
area:metaprogramming:quotes Issues related to quotes and splices area:metaprogramming:reflection Issues related to the quotes reflection API itype:invalid

Comments

@lihaoyi
Copy link
Contributor

lihaoyi commented Jan 26, 2024

Compiler version

3.3.1

Minimized code

Repro steps from com-lihaoyi/mainargs#103

lihaoyi test$ git clone https://github.com/com-lihaoyi/mainargs
Cloning into 'mainargs'...
lihaoyi test$ cd mainargs 
lihaoyi mainargs$ git checkout trait-mains
lihaoyi mainargs$ git checkout main                                
lihaoyi mainargs$ ./mill -i "mainargs.jvm[3.3.1].test" 

Output (click arrow to expand)

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

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/lampepfl/dotty/issues/new/choose

     while compiling: /Users/lihaoyi/test/mainargs/mainargs/test/src/TraitTests.scala
        during phase: erasure
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.10
    compiler version: version 3.3.1
            settings: -bootclasspath /Users/lihaoyi/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.10/scala-library-2.13.10.jar -classpath /Users/lihaoyi/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/utest_3/0.8.1/utest_3-0.8.1.jar:/Users/lihaoyi/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/os-lib_3/0.9.1/os-lib_3-0.9.1.jar:/Users/lihaoyi/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.1/scala3-library_3-3.3.1.jar:/Users/lihaoyi/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_3/2.8.1/scala-collection-compat_3-2.8.1.jar:/Users/lihaoyi/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar:/Users/lihaoyi/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/geny_3/1.0.0/geny_3-1.0.0.jar:/Users/lihaoyi/test/mainargs/mainargs/compile-resources:/Users/lihaoyi/test/mainargs/out/mainargs/jvm/3.3.1/compile.dest/classes:/Users/lihaoyi/test/mainargs/mainargs/test/compile-resources:/Users/lihaoyi/test/mainargs/out/mainargs/jvm/3.3.1/test/compile.dest/classes -d /Users/lihaoyi/test/mainargs/out/mainargs/jvm/3.3.1/test/compile.dest/classes

                tree: $anonfun
       tree position: mainargs/src-3/Macros.scala:93:35
           tree type: ($anonfun :
  (b: mainargs.TraitTests.Main, params: scala.collection.immutable.Seq): Object)
              symbol: method $anonfun
   symbol definition: def $anonfun
  (b: mainargs.TraitTests.Main, params: scala.collection.immutable.Seq): Object (a Symbol)
      symbol package: mainargs
       symbol owners:  in the initializer of value $1$
           call site: method $anonfun in module class mainargs

  == Source file context for tree position ==

-- Error: mainargs/src-3/Macros.scala:93:35 ------------------------------------
93 |      '{ ((b: B, params: Seq[Any]) => ${ callOf('{ params }) }) }
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[error] ## Exception when compiling 22 sources to /Users/lihaoyi/test/mainargs/out/mainargs/jvm/3.3.1/test/compile.dest/classes
[error] java.lang.AssertionError: assertion failed: missing outer accessor in object Main
[error] scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] dotty.tools.dotc.transform.ExplicitOuter$.dotty$tools$dotc$transform$ExplicitOuter$$$outerParamAccessor(ExplicitOuter.scala:237)
[error] dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.loop$1(ExplicitOuter.scala:474)
[error] dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.path$extension(ExplicitOuter.scala:483)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedThis(Erasure.scala:802)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3049)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedSelect(Erasure.scala:669)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3017)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3181)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:836)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3048)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
[error] dotty.tools.dotc.typer.Typer.$anonfun$57(Typer.scala:2486)
[error] dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:243)
[error] dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2486)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:953)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3024)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1052)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1159)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1163)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3056)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
[error] dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:849)
[error] dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:155)
[error] dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:156)
[error] dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:156)
[error] dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:156)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:849)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3048)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3181)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.$anonfun$42(Typer.scala:2028)
[error] dotty.tools.dotc.core.Decorators$.loop$1(Decorators.scala:94)
[error] dotty.tools.dotc.core.Decorators$.mapconserve(Decorators.scala:110)
[error] dotty.tools.dotc.typer.Typer.typedSeqLiteral(Typer.scala:2028)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedSeqLiteral(Erasure.scala:878)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3069)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
[error] dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:849)
[error] dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:155)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:849)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3048)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
[error] dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:849)
[error] dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:155)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:849)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3048)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3181)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
[error] dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:849)
[error] dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:155)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:849)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3048)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
[error] dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:849)
[error] dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:155)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:849)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3048)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3181)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedTyped(Erasure.scala:631)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3053)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3181)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
[error] dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:2424)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedValDef(Erasure.scala:906)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3021)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1052)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1159)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1163)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3056)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3237)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1052)
[error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1159)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1163)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3056)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
[error] dotty.tools.dotc.typer.Typer.$anonfun$57(Typer.scala:2486)
[error] dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:243)
[error] dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2486)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:953)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3024)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1052)
[error] dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2669)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1041)
[error] dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3036)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3040)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1052)
[error] dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2669)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1041)
[error] dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3036)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3040)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
[error] dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1052)
[error] dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2812)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3081)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
[error] dotty.tools.dotc.transform.Erasure.run(Erasure.scala:144)
[error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327)
[error] scala.collection.immutable.List.map(List.scala:250)
[error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331)
[error] dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
[error] dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:279)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:194)
[error] dotty.tools.dotc.Run.compile(Run.scala:179)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
[error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:193)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:183)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:211)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:180)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:178)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:464)
[error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
[error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:419)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:406)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:172)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] mill.scalalib.worker.ZincWorkerImpl.compileInternal(ZincWorkerImpl.scala:540)
[error] mill.scalalib.worker.ZincWorkerImpl.$anonfun$compileMixed$1(ZincWorkerImpl.scala:333)
[error] mill.api.FixSizedCache.withCachedValue(FixSizedCache.scala:66)
[error] mill.scalalib.worker.ZincWorkerImpl.withCompilers(ZincWorkerImpl.scala:413)
[error] mill.scalalib.worker.ZincWorkerImpl.compileMixed(ZincWorkerImpl.scala:332)
[error] mill.scalalib.ScalaModule.$anonfun$compile$2(ScalaModule.scala:210)
[error] mill.define.Task$TraverseCtx.evaluate(Task.scala:71)
[error] mill.eval.GroupEvaluator.$anonfun$evaluateGroup$11(GroupEvaluator.scala:326)
[error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[error] scala.Console$.withErr(Console.scala:193)
[error] mill.api.SystemStreams$.$anonfun$withStreams$2(SystemStreams.scala:62)
[error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[error] scala.Console$.withOut(Console.scala:164)
[error] mill.api.SystemStreams$.$anonfun$withStreams$1(SystemStreams.scala:61)
[error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[error] scala.Console$.withIn(Console.scala:227)
[error] mill.api.SystemStreams$.withStreams(SystemStreams.scala:60)
[error] mill.eval.GroupEvaluator.$anonfun$evaluateGroup$8(GroupEvaluator.scala:326)
[error] mill.eval.GroupEvaluator.$anonfun$evaluateGroup$8$adapted(GroupEvaluator.scala:295)
[error] scala.collection.immutable.Vector.foreach(Vector.scala:2124)
[error] mill.eval.GroupEvaluator.computeAll$1(GroupEvaluator.scala:295)
[error] mill.eval.GroupEvaluator.evaluateGroup(GroupEvaluator.scala:350)
[error] mill.eval.GroupEvaluator.$anonfun$evaluateGroupCached$20(GroupEvaluator.scala:217)
[error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[error] mill.eval.GroupEvaluator.evaluateGroupCached(GroupEvaluator.scala:208)
[error] mill.eval.GroupEvaluator.evaluateGroupCached$(GroupEvaluator.scala:45)
[error] mill.eval.EvaluatorImpl.evaluateGroupCached(EvaluatorImpl.scala:15)
[error] mill.eval.EvaluatorCore.$anonfun$evaluate0$2(EvaluatorCore.scala:116)
[error] scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467)
[error] mill.eval.ExecutionContexts$RunNow$.execute(ExecutionContexts.scala:13)
[error] scala.concurrent.impl.Promise$Transformation.submitWithValue(Promise.scala:429)
[error] scala.concurrent.impl.Promise$DefaultPromise.submitWithValue(Promise.scala:338)
[error] scala.concurrent.impl.Promise$DefaultPromise.dispatchOrAddCallbacks(Promise.scala:312)
[error] scala.concurrent.impl.Promise$DefaultPromise.map(Promise.scala:182)
[error] mill.eval.EvaluatorCore.$anonfun$evaluate0$1(EvaluatorCore.scala:92)
[error] mill.eval.EvaluatorCore.$anonfun$evaluate0$1$adapted(EvaluatorCore.scala:90)
[error] scala.collection.immutable.Vector.foreach(Vector.scala:2124)
[error] mill.eval.EvaluatorCore.evaluate0(EvaluatorCore.scala:90)
[error] mill.eval.EvaluatorCore.$anonfun$evaluate$1(EvaluatorCore.scala:43)
[error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[error] mill.eval.EvaluatorCore.evaluate(EvaluatorCore.scala:34)
[error] mill.eval.EvaluatorCore.evaluate$(EvaluatorCore.scala:26)
[error] mill.eval.EvaluatorImpl.evaluate(EvaluatorImpl.scala:15)
[error] mill.main.RunScript$.evaluateNamed(RunScript.scala:38)
[error] mill.main.RunScript$.$anonfun$evaluateTasksNamed$2(RunScript.scala:26)
[error] scala.util.Either.map(Either.scala:382)
[error] mill.main.RunScript$.evaluateTasksNamed(RunScript.scala:26)
[error] mill.runner.MillBuildBootstrap$.evaluateWithWatches(MillBuildBootstrap.scala:399)
[error] mill.runner.MillBuildBootstrap.$anonfun$processFinalTargets$3(MillBuildBootstrap.scala:308)
[error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[error] mill.runner.MillBuildBootstrap.processFinalTargets(MillBuildBootstrap.scala:308)
[error] mill.runner.MillBuildBootstrap.evaluateRec(MillBuildBootstrap.scala:196)
[error] mill.runner.MillBuildBootstrap.evaluate(MillBuildBootstrap.scala:48)
[error] mill.runner.MillMain$.$anonfun$main0$6(MillMain.scala:234)
[error] mill.runner.Watching$.watchLoop(Watching.scala:27)
[error] mill.runner.MillMain$.$anonfun$main0$1(MillMain.scala:219)
[error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[error] scala.Console$.withErr(Console.scala:193)
[error] mill.api.SystemStreams$.$anonfun$withStreams$2(SystemStreams.scala:62)
[error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[error] scala.Console$.withOut(Console.scala:164)
[error] mill.api.SystemStreams$.$anonfun$withStreams$1(SystemStreams.scala:61)
[error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[error] scala.Console$.withIn(Console.scala:227)
[error] mill.api.SystemStreams$.withStreams(SystemStreams.scala:60)
[error] mill.runner.MillMain$.main0(MillMain.scala:101)
[error] mill.runner.MillMain$.liftedTree1$1(MillMain.scala:78)
[error] mill.runner.MillMain$.main(MillMain.scala:69)
[error] mill.runner.MillMain.main(MillMain.scala)
[error] java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[error] java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] java.base/java.lang.reflect.Method.invoke(Method.java:568)
[error] mill.main.client.IsolatedMillMainLoader.runMain(IsolatedMillMainLoader.java:58)
[error] mill.main.client.MillClientMain.main(MillClientMain.java:64)
[error]            
1 targets failed
mainargs.jvm[3.3.1].test.compile java.lang.AssertionError: assertion failed: missing outer accessor in object Main
    scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
    dotty.tools.dotc.transform.ExplicitOuter$.dotty$tools$dotc$transform$ExplicitOuter$$$outerParamAccessor(ExplicitOuter.scala:237)
    dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.loop$1(ExplicitOuter.scala:474)
    dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.path$extension(ExplicitOuter.scala:483)
    dotty.tools.dotc.transform.Erasure$Typer.typedThis(Erasure.scala:802)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3049)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.transform.Erasure$Typer.typedSelect(Erasure.scala:669)
    dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3017)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3181)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
    dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:836)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3048)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
    dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
    dotty.tools.dotc.typer.Typer.$anonfun$57(Typer.scala:2486)
    dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:243)
    dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2486)
    dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:953)
    dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3024)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
    dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1052)
    dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1159)
    dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1163)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3056)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
    dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
    dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
    dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:849)
    dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:155)
    dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:156)
    dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:156)
    dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:156)
    dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:849)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3048)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
    dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3181)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.$anonfun$42(Typer.scala:2028)
    dotty.tools.dotc.core.Decorators$.loop$1(Decorators.scala:94)
    dotty.tools.dotc.core.Decorators$.mapconserve(Decorators.scala:110)
    dotty.tools.dotc.typer.Typer.typedSeqLiteral(Typer.scala:2028)
    dotty.tools.dotc.transform.Erasure$Typer.typedSeqLiteral(Erasure.scala:878)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3069)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
    dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:849)
    dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:155)
    dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:849)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3048)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
    dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
    dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:849)
    dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:155)
    dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:849)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3048)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3181)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
    dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
    dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
    dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:849)
    dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:155)
    dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:849)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3048)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
    dotty.tools.dotc.transform.Erasure$Typer.$anonfun$7(Erasure.scala:849)
    dotty.tools.dotc.core.Decorators$.zipWithConserve(Decorators.scala:155)
    dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:849)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3048)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
    dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3181)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.transform.Erasure$Typer.typedTyped(Erasure.scala:631)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3053)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3181)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:2047)
    dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:897)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3070)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
    dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:2424)
    dotty.tools.dotc.transform.Erasure$Typer.typedValDef(Erasure.scala:906)
    dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3021)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
    dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1052)
    dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1159)
    dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1163)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3056)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3237)
    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
    dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1052)
    dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1159)
    dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1163)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3056)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
    dotty.tools.dotc.typer.Typer.$anonfun$57(Typer.scala:2486)
    dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:243)
    dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2486)
    dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:953)
    dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3024)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
    dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1052)
    dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2669)
    dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1041)
    dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3036)
    dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3040)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
    dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1052)
    dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2669)
    dotty.tools.dotc.transform.Erasure$Typer.typedClassDef(Erasure.scala:1041)
    dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3036)
    dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3040)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
    dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1052)
    dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2812)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3081)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
    dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:146)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
    dotty.tools.dotc.transform.Erasure.run(Erasure.scala:144)
    dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327)
    scala.collection.immutable.List.map(List.scala:250)
    dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331)
    dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
    scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
    scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
    scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
    dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
    dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
    dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
    dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
    dotty.tools.dotc.Run.compileUnits(Run.scala:279)
    dotty.tools.dotc.Run.compileSources(Run.scala:194)
    dotty.tools.dotc.Run.compile(Run.scala:179)
    dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
    dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
    dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
    sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
    sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:193)
    scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
    sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248)
    sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:183)
    sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
    sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
    sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
    sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:211)
    sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
    sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
    sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:180)
    sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:178)
    sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:464)
    sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
    sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
    sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
    sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
    sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:419)
    sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
    sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:406)
    sbt.internal.inc.Incremental$.apply(Incremental.scala:172)
    sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
    sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
    sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
    sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
    sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
    mill.scalalib.worker.ZincWorkerImpl.compileInternal(ZincWorkerImpl.scala:540)
    mill.scalalib.worker.ZincWorkerImpl.$anonfun$compileMixed$1(ZincWorkerImpl.scala:333)
    mill.api.FixSizedCache.withCachedValue(FixSizedCache.scala:66)
    mill.scalalib.worker.ZincWorkerImpl.withCompilers(ZincWorkerImpl.scala:413)
    mill.scalalib.worker.ZincWorkerImpl.compileMixed(ZincWorkerImpl.scala:332)
    mill.scalalib.ScalaModule.$anonfun$compile$2(ScalaModule.scala:210)
    mill.define.Task$TraverseCtx.evaluate(Task.scala:71)
@lihaoyi lihaoyi added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 26, 2024
@WojciechMazur
Copy link
Contributor

Self contained reproduction, fails in every Scala 3 version:

// defs_1.scala
package mainargs

import scala.annotation.ClassfileAnnotation

class arg() extends ClassfileAnnotation
class main() extends ClassfileAnnotation

class ParserForMethods[B](val mains: MethodMains[B])
object ParserForMethods {
  inline def apply[B](base: B): ParserForMethods[B] = ${ Macros.parserForMethods[B]('base) }
}

case class MethodMains[B](value: Seq[MainData[Any, B]], base: () => B)

class MainData[T, B] private[mainargs] (val invokeRaw: (B, Seq[Any]) => T)
object MainData:
  def create[T, B](invokeRaw: (B, Seq[Any]) => T) = new MainData(invokeRaw)
// macros_1.scala
package mainargs

import scala.quoted._

object Macros {
  private def mainAnnotation(using Quotes) = quotes.reflect.Symbol.requiredClass("mainargs.main")
  private def argAnnotation(using Quotes) = quotes.reflect.Symbol.requiredClass("mainargs.arg")

  def parserForMethods[B](base: Expr[B])(using Quotes, Type[B]): Expr[ParserForMethods[B]] = {
    import quotes.reflect._
    val allMethods = TypeRepr.of[B].typeSymbol.memberMethods
    val annotatedMethodsWithMainAnnotations = allMethods
      .flatMap { methodSymbol =>
        methodSymbol.getAnnotation(mainAnnotation).map(methodSymbol -> _)
      }
      .sortBy(_._1.pos.map(_.start))
    val mainDatas = Expr.ofList(annotatedMethodsWithMainAnnotations.map {
      (annotatedMethod, mainAnnotationInstance) =>
        createMainData[Any, B](annotatedMethod)
    })

    '{
      new ParserForMethods[B](
        MethodMains[B]($mainDatas, () => $base)
      )
    }
  }

  def createMainData[T: Type, B: Type](using
      Quotes
  )(method: quotes.reflect.Symbol): Expr[MainData[T, B]] = {

    import quotes.reflect.*
    val invokeRaw: Expr[(B, Seq[Any]) => T] = {
      def callOf(args: Expr[Seq[Any]]) = call(method, '{ Seq(${ args }) }).asExprOf[T]
      '{ ((b: B, params: Seq[Any]) => ${ callOf('{ params }) }) }
    }
    '{ MainData.create[T, B](${ invokeRaw }) }
  }

  private def call(using Quotes)(
      method: quotes.reflect.Symbol,
      argss: Expr[Seq[Seq[Any]]]
  ): Expr[_] = {
    import quotes.reflect._
    val paramss = method.paramSymss

    val fct = Ref(method)

    val accesses: List[List[Term]] = for (i <- paramss.indices.toList) yield {
      for (j <- paramss(i).indices.toList) yield {
        val tpe = paramss(i)(j).tree.asInstanceOf[ValDef].tpt.tpe
        tpe.asType match
          case '[t] => '{ $argss(${ Expr(i) })(${ Expr(j) }).asInstanceOf[t] }.asTerm
      }
    }

    val base = Apply(fct, accesses.head)
    val application: Apply = accesses.tail.foldLeft(base)((lhs, args) => Apply(lhs, args))
    val expr = application.asExpr
    expr
  }
}
// main_2.scala
import mainargs.*

trait CommandList {
  @main
  def list(@arg v: String) = v
}

object Main extends CommandList {
  def main(args: Array[String]): Unit = ParserForMethods(this)
}

@WojciechMazur WojciechMazur added area:metaprogramming:reflection Issues related to the quotes reflection API area:metaprogramming:quotes Issues related to quotes and splices and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 26, 2024
@lihaoyi
Copy link
Contributor Author

lihaoyi commented Jan 26, 2024

Thanks @WojciechMazur !

@nicolasstucki
Copy link
Contributor

I suspect that the val fct = Ref(method) is wrong. This is a reference to the symbol as seen from its parent. It might need to be qualified with the correct this.

@nicolasstucki
Copy link
Contributor

If we pass base to the call method we can fix this code with

- val fct = Ref(method)
+ val fct = base.asTerm.select(methodSymbol)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metaprogramming:quotes Issues related to quotes and splices area:metaprogramming:reflection Issues related to the quotes reflection API itype:invalid
Projects
None yet
Development

No branches or pull requests

3 participants