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 @@ -34,7 +34,7 @@ object PickledQuotes {
34
34
def quotedExprToTree (expr : quoted.Expr [_])(implicit ctx : Context ): Tree = expr match {
35
35
case expr : TastyExpr [_] => unpickleExpr(expr)
36
36
case expr : ValueExpr [_] => Literal (Constant (expr.value))
37
- case expr : RawExpr [Tree ] @ unchecked => expr.tree
37
+ case expr : TreeExpr [Tree ] @ unchecked => expr.tree
38
38
case expr : FunctionAppliedTo [_, _] =>
39
39
functionAppliedTo(quotedExprToTree(expr.f), quotedExprToTree(expr.x))
40
40
}
@@ -43,7 +43,7 @@ object PickledQuotes {
43
43
def quotedTypeToTree (expr : quoted.Type [_])(implicit ctx : Context ): Tree = expr match {
44
44
case expr : TastyType [_] => unpickleType(expr)
45
45
case expr : TaggedType [_] => classTagToTypeTree(expr.ct)
46
- case expr : RawType [Tree ] @ unchecked => expr.tree
46
+ case expr : TreeType [Tree ] @ unchecked => expr.tree
47
47
}
48
48
49
49
/** 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
@@ -1136,12 +1136,12 @@ class TreeUnpickler(reader: TastyReader,
1136
1136
if (isType) {
1137
1137
val quotedType =
1138
1138
if (args.isEmpty) splice.asInstanceOf [quoted.Type [_]]
1139
- else splice.asInstanceOf [Seq [Any ] => quoted.Type [_]](args.map(tree => new RawType (tree)))
1139
+ else splice.asInstanceOf [Seq [Any ] => quoted.Type [_]](args.map(tree => new TreeType (tree)))
1140
1140
PickledQuotes .quotedTypeToTree(quotedType)
1141
1141
} else {
1142
1142
val quotedExpr =
1143
1143
if (args.isEmpty) splice.asInstanceOf [quoted.Expr [_]]
1144
- else splice.asInstanceOf [Seq [Any ] => quoted.Expr [_]](args.map(tree => new RawExpr (tree)))
1144
+ else splice.asInstanceOf [Seq [Any ] => quoted.Expr [_]](args.map(tree => new TreeExpr (tree)))
1145
1145
PickledQuotes .quotedExprToTree(quotedExpr)
1146
1146
}
1147
1147
Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ class Interpreter(implicit ctx: Context) {
73
73
74
74
tree match {
75
75
case Quoted (quotedTree) =>
76
- if (tree.isTerm) new scala.quoted.Exprs .RawExpr (quotedTree)
77
- else new scala.quoted.Types .RawType (quotedTree)
76
+ if (tree.isTerm) new scala.quoted.Exprs .TreeExpr (quotedTree)
77
+ else new scala.quoted.Types .TreeType (quotedTree)
78
78
79
79
case Literal (Constant (c)) => c.asInstanceOf [Object ]
80
80
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