-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add toExprOfTuple in scala.quoted #7037
Add toExprOfTuple in scala.quoted #7037
Conversation
LGTM! I think we also need something to construct a tuple type given a |
Still need to add at least 23 test |
What would be the signature of the |
How about, def tupleType(tpes: Seq[reflect.Type]): reflect.Type Or should that be |
The context is, I want to be able to generate a trait implementation of the form, class FooImpl extends Foo {
type ElemTypes = <tuple type here>
val Elems: ElemTypes = <tuple term here>
} where the tuple elements are typed tasty trees (from an I'm open to changing the approach so long as I can produce a term of that form from whatever I get back from |
That type for tuple is completely unrelated to this PR. I will add work on It in a different PR. |
8979768
to
0a12ad3
Compare
Awesome ... thanks. And let me know if there's anything I can do to help here. |
Could you make minimal full example/test where the only thing missing is the type of the tuple? |
Possibly related: #7047 though it lifts tuples, not sequences, and is currently blocked. |
@nicolasstucki I'm not sure if that's exactly what you meant by "Could you make minimal full example/test where the only thing missing is the type of the tuple?", but the test I've just added doesn't compile if you uncomment the type annotations, failing with,
|
@@ -0,0 +1,14 @@ | |||
import scala.quoted._ | |||
|
|||
object Macro { |
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 test should be in tests/run-macros
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.
That fixed it. It was probably a bad interaction with the non bootstrapped compiler.
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'm a bit confused ... the test I added didn't compile with the type annotation uncommented, which looked wrong to me. Was that only the case because the test was being compiled with the wrong flags? If that's so then the test should have the type annotations restored, surely? |
I will have a second look at it |
Followed by #7076 |
No description provided.