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

Support for Scala 3 #18

Merged
merged 12 commits into from
Mar 6, 2022
Merged

Support for Scala 3 #18

merged 12 commits into from
Mar 6, 2022

Conversation

lolgab
Copy link
Member

@lolgab lolgab commented Feb 27, 2022

Fixes: #17

What works

Everything except:

Highlights

The macros contains parts that are copy-pasted from Cask.
The not passing tests are wrapped in a function called scala2Only that runs the test only on Scala 2.
The build was updated to Mill 0.10 but I found later that this depends on pprint which is blocked on a Scala Native bug.

@lolgab lolgab changed the title WIP: Support Scala 3 WIP: Support Scala 3 [skip ci] Feb 27, 2022
@lolgab lolgab mentioned this pull request Feb 27, 2022
@lolgab lolgab force-pushed the scala-3-support branch 3 times, most recently from f56f63d to 2c910b4 Compare February 27, 2022 17:19
This implements the support for the `@main` annotated methods in Scala 3.
While `ParserForMethods` is implemented and passes all tests (except the
tests using the old varargs that were moved in the `src-2` directory),
`ParserForClass` is not implemented yet.
@lolgab lolgab changed the title WIP: Support Scala 3 [skip ci] Partial Support for Scala 3 Feb 27, 2022
@lolgab lolgab marked this pull request as ready for review February 28, 2022 08:47
@lolgab lolgab changed the title Partial Support for Scala 3 Support for Scala 3 Feb 28, 2022
Scala Native is not supported yet since it's blocked by PPrint
mainargs/src-3/Macros.scala Outdated Show resolved Hide resolved
mainargs/src-3/Macros.scala Outdated Show resolved Hide resolved
mainargs/src-3/Macros.scala Outdated Show resolved Hide resolved
mainargs/src-3/Macros.scala Outdated Show resolved Hide resolved
def parserForClass[B](using Quotes, Type[B]): Expr[ParserForClass[B]] = {
import quotes.reflect._
val typeReprOfB = TypeRepr.of[B]
val companionModule = typeReprOfB match {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a chance that B doesn't have a companion module?
If so then a graceful fail might be needed here (or if typeSymbolOfB is NoSymbol)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so then a graceful fail might be needed here (or if typeSymbolOfB is NoSymbol)

Do you know how? typeSymbolOfB is not undefined. But the compiler crashes in a way I cannot understand 🤔


#2] [info] exception occurred while compiling /Users/lorenzo/scala/mainargs/mainargs/test/src-3/VersionSpecific.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/Checker.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/ClassTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/CoreTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/DashedArgumentName.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/FlagTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/HelloWorldTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/HygieneTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/MacroTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/ManyTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/NewVarargsTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/OptionSeqTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/ParserTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/PositionalTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/TestUtils.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/VarargsTests.scala
[#0] scala.MatchError: Ident(apply) (of class dotty.tools.dotc.ast.Trees$Ident) while compiling /Users/lorenzo/scala/mainargs/mainargs/test/src-3/VersionSpecific.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/Checker.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/ClassTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/CoreTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/DashedArgumentName.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/FlagTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/HelloWorldTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/HygieneTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/MacroTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/ManyTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/NewVarargsTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/OptionSeqTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/ParserTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/PositionalTests.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/TestUtils.scala, /Users/lorenzo/scala/mainargs/mainargs/test/src/VarargsTests.scala
[#2] [error] ## Exception when compiling 16 sources to /Users/lorenzo/scala/mainargs/out/mainargs/jvm/3.0.2/test/compile.dest/classes
[#2] [error] scala.MatchError: Ident(apply) (of class dotty.tools.dotc.ast.Trees$Ident)
[#2] [error] dotty.tools.dotc.typer.Typer.newExpr$1(Typer.scala:3759)
[#2] [error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3804)
[#2] [error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3162)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2941)
[#2] [error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:882)
[#2] [error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1032)
[#2] [error] dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:317)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1535)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2693)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2818)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1768)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2715)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2941)
[#2] [error] dotty.tools.dotc.typer.Typer.$anonfun$34(Typer.scala:2156)
[#2] [error] dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:225)
[#2] [error] dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2156)
[#2] [error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2670)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2755)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2847)
[#2] [error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2897)
[#2] [error] dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1025)
[#2] [error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1029)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2701)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedSelect(Inliner.scala:1492)
[#2] [error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2663)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2755)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2941)
[#2] [error] dotty.tools.dotc.typer.Applications.typedTypeApply(Applications.scala:1084)
[#2] [error] dotty.tools.dotc.typer.Applications.typedTypeApply$(Applications.scala:317)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedTypeApply(Inliner.scala:1549)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2712)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1768)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2715)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1768)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2715)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$5(ProtoTypes.scala:428)
[#2] [error] dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:359)
[#2] [error] dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:429)
[#2] [error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:850)
[#2] [error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:850)
[#2] [error] dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:544)
[#2] [error] dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:609)
[#2] [error] dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:609)
[#2] [error] dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:609)
[#2] [error] dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:609)
[#2] [error] dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:447)
[#2] [error] dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:735)
[#2] [error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:849)
[#2] [error] dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1057)
[#2] [error] dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:317)
[#2] [error] dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:106)
[#2] [error] dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:904)
[#2] [error] dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:983)
[#2] [error] dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2949)
[#2] [error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:994)
[#2] [error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1032)
[#2] [error] dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:317)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1535)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2693)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1768)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2715)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1768)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2715)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedSelect(Inliner.scala:1492)
[#2] [error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2663)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2755)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2941)
[#2] [error] dotty.tools.dotc.typer.Applications.typedTypeApply(Applications.scala:1084)
[#2] [error] dotty.tools.dotc.typer.Applications.typedTypeApply$(Applications.scala:317)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedTypeApply(Inliner.scala:1549)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2712)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$5(ProtoTypes.scala:428)
[#2] [error] dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:359)
[#2] [error] dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:429)
[#2] [error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:850)
[#2] [error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:850)
[#2] [error] dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:544)
[#2] [error] dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:609)
[#2] [error] dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:447)
[#2] [error] dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:735)
[#2] [error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:849)
[#2] [error] dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1057)
[#2] [error] dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:317)
[#2] [error] dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:106)
[#2] [error] dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:904)
[#2] [error] dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:983)
[#2] [error] dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2949)
[#2] [error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:994)
[#2] [error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1032)
[#2] [error] dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:317)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1535)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2693)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$5(ProtoTypes.scala:428)
[#2] [error] dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:359)
[#2] [error] dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:429)
[#2] [error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:850)
[#2] [error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:850)
[#2] [error] dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:544)
[#2] [error] dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:609)
[#2] [error] dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:447)
[#2] [error] dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:735)
[#2] [error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:849)
[#2] [error] dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1057)
[#2] [error] dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:317)
[#2] [error] dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:106)
[#2] [error] dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:904)
[#2] [error] dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:983)
[#2] [error] dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2949)
[#2] [error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:994)
[#2] [error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1032)
[#2] [error] dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:317)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1535)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2693)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1768)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2715)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2818)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2941)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1540)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2693)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:62)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2698)
[#2] [error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
[#2] [error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[#2] [error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedUnadapted(Inliner.scala:1622)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2818)
[#2] [error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
[#2] [error] dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:1016)
[#2] [error] dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:153)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:86)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1490)
[#2] [error] scala.collection.immutable.List.mapConserve(List.scala:472)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1490)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1386)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1490)
[#2] [error] scala.collection.immutable.List.mapConserve(List.scala:472)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1490)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1386)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1490)
[#2] [error] scala.collection.immutable.List.mapConserve(List.scala:472)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1490)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1418)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1394)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:82)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1490)
[#2] [error] scala.collection.immutable.List.mapConserve(List.scala:472)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1490)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1386)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1380)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1490)
[#2] [error] scala.collection.immutable.List.mapConserve(List.scala:472)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1490)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1386)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1490)
[#2] [error] scala.collection.immutable.List.mapConserve(List.scala:472)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1490)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1386)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1490)
[#2] [error] scala.collection.immutable.List.mapConserve(List.scala:472)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1490)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1386)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1420)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1454)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:111)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1463)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60)
[#2] [error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1474)
[#2] [error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:120)
[#2] [error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[#2] [error] dotty.tools.dotc.transform.Inlining$$anon$2.transform(Inlining.scala:72)
[#2] [error] dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21)
[#2] [error] dotty.tools.dotc.transform.Inlining.run(Inlining.scala:44)
[#2] [error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:303)
[#2] [error] scala.collection.immutable.List.map(List.scala:250)
[#2] [error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:304)
[#2] [error] dotty.tools.dotc.transform.Inlining.runOn(Inlining.scala:48)
[#2] [error] dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:205)
[#2] [error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[#2] [error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[#2] [error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[#2] [error] dotty.tools.dotc.Run.runPhases$5(Run.scala:216)
[#2] [error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:224)
[#2] [error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
[#2] [error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
[#2] [error] dotty.tools.dotc.Run.compileUnits(Run.scala:231)
[#2] [error] dotty.tools.dotc.Run.compileSources(Run.scala:166)
[#2] [error] dotty.tools.dotc.Run.compile(Run.scala:150)
[#2] [error] dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
[#2] [error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
[#2] [error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[#2] [error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[#2] [error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192)
[#2] [error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
[#2] [error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247)
[#2] [error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182)
[#2] [error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
[#2] [error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[#2] [error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
[#2] [error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210)
[#2] [error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528)
[#2] [error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528)
[#2] [error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:177)
[#2] [error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:175)
[#2] [error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:461)
[#2] [error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[#2] [error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[#2] [error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[#2] [error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
[#2] [error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:416)
[#2] [error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:503)
[#2] [error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:403)
[#2] [error] sbt.internal.inc.Incremental$.apply(Incremental.scala:169)
[#2] [error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528)
[#2] [error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482)
[#2] [error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[#2] [error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
[#2] [error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[#2] [error] mill.scalalib.worker.ZincWorkerImpl.compileInternal(ZincWorkerImpl.scala:544)
[#2] [error] mill.scalalib.worker.ZincWorkerImpl.$anonfun$compileMixed0$1(ZincWorkerImpl.scala:317)
[#2] [error] mill.api.FixSizedCache.withCachedValue(FixSizedCache.scala:66)
[#2] [error] mill.scalalib.worker.ZincWorkerImpl.withCompilers(ZincWorkerImpl.scala:399)
[#2] [error] mill.scalalib.worker.ZincWorkerImpl.compileMixed0(ZincWorkerImpl.scala:316)
[#2] [error] mill.scalalib.worker.ZincWorkerImpl.compileMixed(ZincWorkerImpl.scala:284)
[#2] [error] mill.scalalib.ScalaModule.$anonfun$compile$2(ScalaModule.scala:195)
[#2] [error] mill.define.Task$TraverseCtx.evaluate(Task.scala:376)
[#2] [error] mill.eval.Evaluator.$anonfun$evaluateGroup$13(Evaluator.scala:505)
[#2] [error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[#2] [error] scala.Console$.withErr(Console.scala:193)
[#2] [error] mill.eval.Evaluator.$anonfun$evaluateGroup$12(Evaluator.scala:505)
[#2] [error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[#2] [error] scala.Console$.withOut(Console.scala:164)
[#2] [error] mill.eval.Evaluator.$anonfun$evaluateGroup$11(Evaluator.scala:504)
[#2] [error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[#2] [error] scala.Console$.withIn(Console.scala:227)
[#2] [error] mill.eval.Evaluator.$anonfun$evaluateGroup$8(Evaluator.scala:503)
[#2] [error] mill.eval.Evaluator.$anonfun$evaluateGroup$8$adapted(Evaluator.scala:464)
[#2] [error] scala.collection.immutable.Vector.foreach(Vector.scala:1856)
[#2] [error] mill.eval.Evaluator.evaluateGroup(Evaluator.scala:464)
[#2] [error] mill.eval.Evaluator.$anonfun$evaluateGroupCached$13(Evaluator.scala:359)
[#2] [error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
[#2] [error] mill.eval.Evaluator.evaluateGroupCached(Evaluator.scala:350)
[#2] [error] mill.eval.Evaluator.$anonfun$parallelEvaluate$2(Evaluator.scala:227)
[#2] [error] scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467)
[#2] [error] java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[#2] [error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[#2] [error] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[#2] [error] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[#2] [error] java.lang.Thread.run(Thread.java:748)

mainargs/src-3/Macros.scala Show resolved Hide resolved
mainargs/src-3/Macros.scala Outdated Show resolved Hide resolved
mainargs/src-3/Macros.scala Outdated Show resolved Hide resolved
@lolgab
Copy link
Member Author

lolgab commented Mar 2, 2022

@KacperFKorban Thank you for your kind review! The code looks much better now! 😊


object Macros {
private def mainAnnotation(using Quotes) = quotes.reflect.TypeRepr.of[mainargs.main].typeSymbol
private def argAnnotation(using Quotes) = quotes.reflect.TypeRepr.of[mainargs.arg].typeSymbol

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a bit more performant

  private def argAnnotation(using Quotes) = quotes.reflect.TypeRepr.typeConstructorOf[mainargs.arg].typeSymbol

Or maybe this one is even better

  private def argAnnotation(using Quotes) = quotes.reflect.Symbol.requiredClass("mainargs.arg")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for mainAnnotation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thank you ✅


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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MethodMains[B](${ mainDatas }, () => ${ base })
MethodMains[B]($mainDatas, () => $base)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thank you ✅

val companionModuleType = typeSymbolOfB.companionModule.tree.asInstanceOf[ValDef].tpt.tpe.asType
val companionModuleExpr = Ident(companionModule).asExpr
val mainAnnotationInstance = typeSymbolOfB.getAnnotation(mainAnnotation).getOrElse {
report.throwError(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throwError was depecated and equivalent to

Suggested change
report.throwError(
report.errorAndAbort(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get an error since I'm compiling with Scala 3.0.2 and I want to be compatible with Scala 3.0

method errorAndAbort is marked @experimental and therefore may only be used with a nightly or snapshot version of the compiler

paramType match
case '[t] =>
val defaultParam: Expr[Option[B => t]] = defaultParams.get(param) match {
case Some(v) => '{ Some(((_: B) => $v).asInstanceOf[B => t]) }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if you can do something like this and avoid the asInstanceOf

            case Some('{ $p: `t`}) => '{ Some(((_: B) => $v)) }

`t` reverse to the outer t and does not create a new type variable in the pattern

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thank you ✅

case None => '{ None }
}
val argReader = Expr.summon[mainargs.ArgReader[t]].getOrElse {
report.throwError(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
report.throwError(
report.errorAndAbort(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

param.pos.get
)
}
'{ (ArgSig.create[t, B](${ Expr(param.name) }, ${ arg }, ${ defaultParam })(using ${ argReader })).asInstanceOf[ArgSig[Any, B]] }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might be able to avoid the cast if you do ArgSig.create[Any, B](...)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise I would sugest using asExprOf

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried both without success.


val invokeRaw: Expr[(B, Seq[Any]) => T] = {
def callOf(args: Expr[Seq[Any]]) = call(method, '{ Seq( ${ args }) })
'{ ((b: B, params: Seq[Any]) => ${ callOf('{ params }) }).asInstanceOf[(B, Seq[Any]) => T] }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try using asExprOf on the quote instead of asInstanceOf inside of it.

Copy link
Member Author

@lolgab lolgab Mar 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

val paramss = method.paramSymss

if (paramss.isEmpty) {
report.throwError("At least one parameter list must be declared.", method.pos.get)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
report.throwError("At least one parameter list must be declared.", method.pos.get)
report.errorAndAbort("At least one parameter list must be declared.", method.pos.get)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@lolgab
Copy link
Member Author

lolgab commented Mar 4, 2022

Thank you for your review @nicolasstucki! Very appreciated! 🙏

Copy link
Member

@lihaoyi lihaoyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know the Scala 3 stuff, but if the existing tests pass then I think that's enough confidence that nothing broke

@lolgab lolgab merged commit a4ca160 into com-lihaoyi:master Mar 6, 2022
@lolgab lolgab deleted the scala-3-support branch March 6, 2022 09:15
@lefou lefou added this to the 0.2.3 milestone Sep 9, 2022
mpollmeier added a commit to mpollmeier/Ammonite that referenced this pull request Oct 6, 2022
mpollmeier added a commit to mpollmeier/Ammonite that referenced this pull request Oct 6, 2022
mpollmeier added a commit to mpollmeier/Ammonite that referenced this pull request Oct 7, 2022
mainargs 0.2.3 [added support for scala3](com-lihaoyi/mainargs#18) 🎉

To test (manually):

test.sc:
```scala
@main def main(name: String) = {
  println(s"Hello, $name!")
}
```

```bash
mill -i "amm[3.2.0].assembly" && out/amm/3.2.0/assembly.dest/out.jar test.sc --name Michael
mill -i "amm[2.13.9].assembly" && out/amm/2.13.9/assembly.dest/out.jar test.sc --name Michael
```
mpollmeier added a commit to mpollmeier/Ammonite that referenced this pull request Oct 17, 2022
mainargs 0.2.3 added support for scala3 🎉
com-lihaoyi/mainargs#18

The first attempt to upgrade and enable mainargs was
com-lihaoyi#1298, but the build
changes were better handled by com-lihaoyi#1301

So the only thing left is reenabling mainargs for Scala 3.
lolgab pushed a commit to com-lihaoyi/Ammonite that referenced this pull request Oct 17, 2022
mainargs 0.2.3 added support for scala3 🎉
com-lihaoyi/mainargs#18

The first attempt to upgrade and enable mainargs was
#1298, but the build
changes were better handled by #1301

So the only thing left is reenabling mainargs for Scala 3.
val companionModuleType = typeSymbolOfB.companionModule.tree.asInstanceOf[ValDef].tpt.tpe.asType
val companionModuleExpr = Ident(companionModule).asExpr
val mainAnnotationInstance = typeSymbolOfB.getAnnotation(mainAnnotation).getOrElse {
report.throwError(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lolgab why did you make it throw here? the main annotation is not necessary if you look at the Scala 2 implementation - and a default is provided

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was probably an overlook on my side. If you can change it to match the Scala 2 behavior we can release a new version, so you can continue with Mill's Scala 3 upgrade.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright, no worries :)

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

Successfully merging this pull request may close these issues.

Add support for Scala 3
7 participants