-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix example code from How to write a type class derived method using macros #10382
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
(I just signed the CLA) |
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.
Thanks! @nicolasstucki Can you double-check that this is still a good example for the documentation?
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.
LGTM. I just added a couple of extra simplification.
Thank you @ghostdogpr |
case '[String *: $tpes] => '{ summon[Eq[String]] } :: summonAll(tpes) | ||
case '[Int *: $tpes] => '{ summon[Eq[Int]] } :: summonAll(tpes) | ||
case '[$tpe *: $tpes] => derived(using tpe, qctx) :: summonAll(tpes) | ||
def summonAll[T: Type](using qctx: QuoteContext): List[Expr[Eq[_]]] = t 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.
@nicolasstucki Does this actually compile? I don't see where t
is defined here. Also if we update the doc we should keep the test case synchronized: https://github.com/lampepfl/dotty/blob/master/tests/run-macros/i8007/Macro_3.scala
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 missed that. I will fix 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.
Fix in #10395
Closes #10381