-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add TASTy reflect constructors #5438
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 TASTy reflect constructors #5438
Conversation
55be7b7
to
19d0ae9
Compare
It would be nice if we can prioritize this, as is required to implement ScalaTest macros. For example, to support |
We may not need the constructors to perform those operation. We do have some tricks to encode those with quotes and splices. |
9728a66
to
f64b67d
Compare
07db2e3
to
852b423
Compare
19f89e7
to
f206a33
Compare
3cdb02b
to
7b16047
Compare
48c6d83
to
9304a3a
Compare
* Add tree constructors (apply in their module) * Add tree copier (copy in their module) * Add missing parameter of Term.Repeated * Add Term.Ref as a supertype of Term.Ident and Term.Select * Rename Project by Projection
9304a3a
to
5419a4c
Compare
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'm not against merging this and iterate fast. I would first focus on constructors for terms and make sure they satisfy the needs (as the use cases for type trees and patterns are not clear).
case lit: tpd.Literal => tpd.cpy.Literal(original)(lit.const) | ||
case ref: tpd.RefTree if ref.isTerm => tpd.cpy.Ref(original.asInstanceOf[tpd.RefTree])(ref.name) | ||
case ths: tpd.This => tpd.cpy.This(original)(ths.qual) | ||
} |
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.
Do we need apply
and copy
for Value
? I have the impression that constructors are usually concrete.
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.
Yes, I am considering splitting the Value
type into more concrete types for literals and term references
@@ -114,6 +131,8 @@ trait TreeOps extends Core { | |||
|
|||
val DefDef: DefDefModule | |||
abstract class DefDefModule { | |||
def apply(symbol: DefSymbol, rhsFn: List[Type] => List[List[Term]] => Option[Term])(implicit ctx: Context): DefDef |
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.
Do we have API to create symbols in order to use this constructor? The same for ValDef
.
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.
No. Needs to be added.
|
||
// TODO def apply(qualifier: Term, name: String, signature: Option[Signature])(implicit ctx: Context): Select | ||
|
||
def copy(original: Tree)(qualifier: Term, name: String)(implicit ctx: Context): Select |
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.
For later: some documentation is needed to specify what is going to happen if name
is overloaded.
@nicolasstucki the description of this merged PR says that it is based on a PR that is not merged yet. Can you summarize the situation very briefly? |
I removed the commits from the other PR (i.e. this is not based on that PR). I forgot to remove the comment. |
Merci! |
No description provided.