-
Notifications
You must be signed in to change notification settings - Fork 1.1k
No Labels found when Summoning Mirror and Passing to a Splice #8007
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
Comments
I am trying to minimize this code but if I try to just returned the summoned mirror like this: def usingSummonFromImpl[T: Type](value: Expr[T], m: Option[Mirror.Of[T]])(given qctx: QuoteContext): Expr[Mirror.Of[T]] = {
import qctx.tasty.{_, given}
val theMirror = m match { case Some(mirror) => mirror }
Expr(theMirror)
} I run into the following error:
Is there a way to wrap this mirror into an Expr and return it directly? |
Thanks for reporting this (these are super useful reports, keep them coming because they combine features). Just a small note: apart from minimisation it is super useful if we also get the imports, the enclosing objects and the Regarding the error I didn't solve it but I have some observations: Initially, my reaction was that cannot reduce inline match with
| scrutinee: scala.compiletime.erasedValue[m.MirroredElemTypes] : m.MirroredElemTypes
| patterns : case _:*:[field @ _, fields @ _]
| case _:Unit The documented way to summon a given is with case '{$m: Mirror.ProductOf[T]} => "it's a product: " + mirrorFields[$m.MirroredElemLabels] I added the test and will continue the investigation #8011 |
@biboudis I'm assuming that |
#8011 demonstrates the workaround/solution to this problem |
Fix #8007: Add regression and show type class derivation with macros
minimized code
expectation
Say we have a
case class Person(name: String, age :Int)
, the fieldsList("name", "age")
should be returned. Instead, the mirror contains no fields.The text was updated successfully, but these errors were encountered: