- Notifications
You must be signed in to change notification settings - Fork 27
Support for Scala 3 #18
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
Conversation
f56f63d to 2c910b4 Compare 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.
2c910b4 to 2420e1e Compare 2420e1e to 7c7f88c Compare 0c2cdb7 to 3b33efc Compare 3b33efc to 71c0dd1 Compare Scala Native is not supported yet since it's blocked by PPrint
| def parserForClass[B](using Quotes, Type[B]): Expr[ParserForClass[B]] = { | ||
| import quotes.reflect._ | ||
| val typeReprOfB = TypeRepr.of[B] | ||
| val companionModule = typeReprOfB match { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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) | @KacperFKorban Thank you for your kind review! The code looks much better now! 😊 |
mainargs/src-3/Macros.scala Outdated
| | ||
| 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 |
There was a problem hiding this comment.
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].typeSymbolOr maybe this one is even better
private def argAnnotation(using Quotes) = quotes.reflect.Symbol.requiredClass("mainargs.arg")There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for mainAnnotation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thank you ✅
mainargs/src-3/Macros.scala Outdated
| | ||
| '{ | ||
| new ParserForMethods[B]( | ||
| MethodMains[B](${ mainDatas }, () => ${ base }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| MethodMains[B](${ mainDatas }, () => ${ base }) | |
| MethodMains[B]($mainDatas, () => $base) |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
| report.throwError( | |
| report.errorAndAbort( |
There was a problem hiding this comment.
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 mainargs/src-3/Macros.scala Outdated
| paramType match | ||
| case '[t] => | ||
| val defaultParam: Expr[Option[B => t]] = defaultParams.get(param) match { | ||
| case Some(v) => '{ Some(((_: B) => $v).asInstanceOf[B => t]) } |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| report.throwError( | |
| report.errorAndAbort( |
There was a problem hiding this comment.
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]] } |
There was a problem hiding this comment.
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](...)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
mainargs/src-3/Macros.scala Outdated
| | ||
| 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] } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| Thank you for your review @nicolasstucki! Very appreciated! 🙏 |
lihaoyi left a comment
There was a problem hiding this 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
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 ```
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.
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( |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright, no worries :)
Fixes: #17
What works
Everything except:
@argannotations in case classes for withParserForClassare ignored (Blocked by Meta-annotations written at use-site are ignored scala/scala3#12492)ParserForClassare ignored (Blocked by No way to resolve the parameters & fields default values scala/scala3#14093)Highlights
The macros contains parts that are copy-pasted from Cask.
The not passing tests are wrapped in a function called
scala2Onlythat 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.