File tree 5 files changed +17
-13
lines changed
compiler/src/dotty/tools/dotc
5 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ object PickledQuotes {
38
38
def quotedExprToTree (expr : quoted.Expr [_])(implicit ctx : Context ): Tree = expr match {
39
39
case expr : TastyExpr [_] => unpickleExpr(expr)
40
40
case expr : ValueExpr [_] => Literal (Constant (expr.value))
41
- case expr : RawExpr [Tree ] @ unchecked => expr.tree
41
+ case expr : TreeExpr [Tree ] @ unchecked => expr.tree
42
42
case expr : FunctionAppliedTo [_, _] =>
43
43
functionAppliedTo(quotedExprToTree(expr.f), quotedExprToTree(expr.x))
44
44
}
@@ -47,7 +47,7 @@ object PickledQuotes {
47
47
def quotedTypeToTree (expr : quoted.Type [_])(implicit ctx : Context ): Tree = expr match {
48
48
case expr : TastyType [_] => unpickleType(expr)
49
49
case expr : TaggedType [_] => classTagToTypeTree(expr.ct)
50
- case expr : RawType [Tree ] @ unchecked => expr.tree
50
+ case expr : TreeType [Tree ] @ unchecked => expr.tree
51
51
}
52
52
53
53
/** Unpickle the tree contained in the TastyExpr */
Original file line number Diff line number Diff line change @@ -21,8 +21,8 @@ import typer.Checking
21
21
import config .Config
22
22
import dotty .tools .dotc .core .quoted .PickledQuotes
23
23
import scala .quoted
24
- import scala .quoted .Types .RawType
25
- import scala .quoted .Exprs .RawExpr
24
+ import scala .quoted .Types .TreeType
25
+ import scala .quoted .Exprs .TreeExpr
26
26
27
27
/** Unpickler for typed trees
28
28
* @param reader the reader from which to unpickle
@@ -1100,12 +1100,12 @@ class TreeUnpickler(reader: TastyReader,
1100
1100
if (isType) {
1101
1101
val quotedType =
1102
1102
if (args.isEmpty) splice.asInstanceOf [quoted.Type [_]]
1103
- else splice.asInstanceOf [Seq [Any ] => quoted.Type [_]](args.map(tree => new RawType (tree)))
1103
+ else splice.asInstanceOf [Seq [Any ] => quoted.Type [_]](args.map(tree => new TreeType (tree)))
1104
1104
PickledQuotes .quotedTypeToTree(quotedType)
1105
1105
} else {
1106
1106
val quotedExpr =
1107
1107
if (args.isEmpty) splice.asInstanceOf [quoted.Expr [_]]
1108
- else splice.asInstanceOf [Seq [Any ] => quoted.Expr [_]](args.map(tree => new RawExpr (tree)))
1108
+ else splice.asInstanceOf [Seq [Any ] => quoted.Expr [_]](args.map(tree => new TreeExpr (tree)))
1109
1109
PickledQuotes .quotedExprToTree(quotedExpr)
1110
1110
}
1111
1111
Original file line number Diff line number Diff line change @@ -72,8 +72,8 @@ class Interpreter(implicit ctx: Context) {
72
72
73
73
tree match {
74
74
case Quoted (quotedTree) =>
75
- if (tree.isTerm) new scala.quoted.Exprs .RawExpr (quotedTree)
76
- else new scala.quoted.Types .RawType (quotedTree)
75
+ if (tree.isTerm) new scala.quoted.Exprs .TreeExpr (quotedTree)
76
+ else new scala.quoted.Types .TreeType (quotedTree)
77
77
78
78
case Literal (Constant (c)) => c.asInstanceOf [Object ]
79
79
Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ object Expr {
19
19
20
20
}
21
21
22
- /** All implementations of Expr[T] */
22
+ /** All implementations of Expr[T].
23
+ * These should never be used directly.
24
+ */
23
25
object Exprs {
24
26
/** An Expr backed by a pickled TASTY tree */
25
27
final class TastyExpr [T ](val tasty : Pickled , val args : Seq [Any ]) extends Expr [T ] {
@@ -33,8 +35,8 @@ object Exprs {
33
35
override def toString : String = s " Expr( $value) "
34
36
}
35
37
36
- /** An Expr backed by a tree */
37
- final class RawExpr [Tree ](val tree : Tree ) extends quoted.Expr [Any ] {
38
+ /** An Expr backed by a tree. Only the current compiler trees are allowed. */
39
+ final class TreeExpr [Tree ](val tree : Tree ) extends quoted.Expr [Any ] {
38
40
override def toString : String = s " Expr(<raw>) "
39
41
}
40
42
Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ object Type {
21
21
implicit def DoubleTag : Type [Double ] = new TaggedType [Double ]
22
22
}
23
23
24
- /** Implementations of Type[T] */
24
+ /** All implementations of Type[T].
25
+ * These should never be used directly.
26
+ */
25
27
object Types {
26
28
/** A Type backed by a pickled TASTY tree */
27
29
final class TastyType [T ](val tasty : Pickled , val args : Seq [Any ]) extends Type [T ] {
@@ -34,7 +36,7 @@ object Types {
34
36
}
35
37
36
38
/** An Type backed by a tree */
37
- final class RawType [Tree ](val tree : Tree ) extends quoted.Type [Any ] {
39
+ final class TreeType [Tree ](val tree : Tree ) extends quoted.Type [Any ] {
38
40
override def toString : String = s " Type(<raw>) "
39
41
}
40
42
}
You can’t perform that action at this time.
0 commit comments