You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently use the `Quote` and `Splice` ASTs for untyped quotes and
splices. Then when we type them we encode them into
`scala.quoted.runtime.Expr.{quote,splice,nestedSplice}`. This
non-semantic representation if fragile and the source of many past bug.
In this PR we change the internal representation of quotes and splices
to use the `Quote` and `Splice` ASTs as typed trees.
The core of this change in the AST representation and how we type them
in `QuotesAndSplices`. Other changes consist in adapting the code from
one representation to the other.
```diff
- case class Quote(quoted: Tree)(implicit @constructorOnly src: SourceFile) extends TermTree
+ case class Quote[+T <: Untyped] private[ast] (body: Tree[T])(implicit @constructorOnly src: SourceFile) extends TermTree[T]
- case class Splice(expr: Tree)(implicit @constructorOnly src: SourceFile) extends TermTree
+ case class Splice[+T <: Untyped] private[ast] (expr: Tree[T])(implicit @constructorOnly src: SourceFile) extends TermTree[T]
```
* We do not change the TASTy (file and reflection) representation of
quotes and splices. This is something that we should consider adding in
a future PR.
* We can use the simpler encoding of `splice` in all cases. The
additional `Quotes` in `nestedSplice` is not used.
* This does not change binary compatibility.
0 commit comments