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 generics when deriving Parser in scala 3 #602

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

eejbyfeldt
Copy link

Currently when trying to derive a parser for the new test case fails with

-- Error: alexarchambault/case-app/tests/shared/src/test/scala/caseapp/CaseAppTests.scala:632:42 
632 |        Parser[GenericArgs[SharedOptions]].detailedParse(
    |                                          ^
    |Exception occurred while executing macro expansion.
    |java.lang.Exception: No given caseapp.core.parser.Parser[Shared] instance found
    |	at caseapp.core.parser.LowPriorityParserImplicits$.headParserExpr$lzyINIT1$1(LowPriorityParserImplicits.scala:165)
    |	at caseapp.core.parser.LowPriorityParserImplicits$.headParserExpr$1(LowPriorityParserImplicits.scala:166)
    |	at caseapp.core.parser.LowPriorityParserImplicits$.$anonfun$15(LowPriorityParserImplicits.scala:200)
    |	at caseapp.core.parser.LowPriorityParserImplicits$.$anonfun$adapted$2(LowPriorityParserImplicits.scala:202)
    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:110)
    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1544)
    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:135)
    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1614)
    |	at scala.collection.immutable.List.mapConserve(List.scala:473)
    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1614)
    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1510)
    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:135)
    |	at dotty.tools.dotc.quoted.PickledQuotes$.spliceTerms(PickledQuotes.scala:152)
    |	at dotty.tools.dotc.quoted.PickledQuotes$.unpickleTerm(PickledQuotes.scala:88)
    |	at scala.quoted.runtime.impl.QuotesImpl.unpickleExprV2(QuotesImpl.scala:3185)
    |	at caseapp.core.parser.LowPriorityParserImplicits$.$anonfun$6(LowPriorityParserImplicits.scala:202)
    |	at scala.collection.immutable.List.foldRight(List.scala:353)
    |	at caseapp.core.parser.LowPriorityParserImplicits$.tupleParserImpl(LowPriorityParserImplicits.scala:110)
    |	at caseapp.core.parser.LowPriorityParserImplicits$.inline$tupleParserImpl(LowPriorityParserImplicits.scala:77)
    |
    |---------------------------------------------------------------------------
    |Inline stack trace
    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    |This location contains code that was inlined from LowPriorityParserImplicits.scala:76
 76 |    ${ tupleParserImpl[T] }
    |    ^^^^^^^^^^^^^^^^^^^^^^^
    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    |This location contains code that was inlined from LowPriorityParserImplicits.scala:76
246 |    val parser = LowPriorityParserImplicits.tupleParser[T]
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     ---------------------------------------------------------------------------
one error found

@eejbyfeldt
Copy link
Author

Also noticed that default values did not work for case class using generics. So added another commit: 27ff11a fixing that as well.

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.

1 participant