Summoning a FromExpr in a macro is failing #16726
Unanswered
hmf
asked this question in
Metaprogramming
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This question follows from this issue that I incorrectly filed as a bug. More concretely I want to access the values of a Tuple and an HList of mine. Here are 2 examples from the answer of the issue I refer to above (my use case is the second one):
The problem is that I think that the only way to get the correct type class is to use
Expr.summon
. I have been struggling for some time now and cannot seem to solve this. Here is my test case (apologies for the length, but most of it are printouts to show later):In another file I use:
And I get the following output:
One can see from the printouts that the Tuple's case class cannot be found. Why is that?
I have asked questions in the Scala user's Discourse forum and the Discord Scalameta chat with no luck. I have scoured the Internet and the dotty docs and cannot figure out what I am doing wrong. In particular I found Adam Warski's Scala 3 macros tips & tricks (see related question in this forum), which seems to indicate that I am not too far from the solution.
EDIT:
Strangely enough I cannot get his example to work.Here is the code I used (slight change to to get it to compile):And in another file, I use:
And compilation succeeds.
Can anyone advise me on what to try next?
TIA
With the above I get:Seems like the same type of problem. The article is from May of 2021, so I wonder if something has changed since then.Beta Was this translation helpful? Give feedback.
All reactions