Skip to content

Commit 9057b92

Browse files
committed
Rename Raw{Expr|Type} to Tree{Expr|Type}
1 parent fada008 commit 9057b92

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ object PickledQuotes {
3838
def quotedExprToTree(expr: quoted.Expr[_])(implicit ctx: Context): Tree = expr match {
3939
case expr: TastyExpr[_] => unpickleExpr(expr)
4040
case expr: ValueExpr[_] => Literal(Constant(expr.value))
41-
case expr: RawExpr[Tree] @unchecked => expr.tree
41+
case expr: TreeExpr[Tree] @unchecked => expr.tree
4242
case expr: FunctionAppliedTo[_, _] =>
4343
functionAppliedTo(quotedExprToTree(expr.f), quotedExprToTree(expr.x))
4444
}
@@ -47,7 +47,7 @@ object PickledQuotes {
4747
def quotedTypeToTree(expr: quoted.Type[_])(implicit ctx: Context): Tree = expr match {
4848
case expr: TastyType[_] => unpickleType(expr)
4949
case expr: TaggedType[_] => classTagToTypeTree(expr.ct)
50-
case expr: RawType[Tree] @unchecked => expr.tree
50+
case expr: TreeType[Tree] @unchecked => expr.tree
5151
}
5252

5353
/** Unpickle the tree contained in the TastyExpr */

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import typer.Checking
2121
import config.Config
2222
import dotty.tools.dotc.core.quoted.PickledQuotes
2323
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
2626

2727
/** Unpickler for typed trees
2828
* @param reader the reader from which to unpickle
@@ -1100,12 +1100,12 @@ class TreeUnpickler(reader: TastyReader,
11001100
if (isType) {
11011101
val quotedType =
11021102
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)))
11041104
PickledQuotes.quotedTypeToTree(quotedType)
11051105
} else {
11061106
val quotedExpr =
11071107
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)))
11091109
PickledQuotes.quotedExprToTree(quotedExpr)
11101110
}
11111111

compiler/src/dotty/tools/dotc/interpreter/Interpreter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ class Interpreter(implicit ctx: Context) {
7272

7373
tree match {
7474
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)
7777

7878
case Literal(Constant(c)) => c.asInstanceOf[Object]
7979

library/src/scala/quoted/Expr.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ object Expr {
1919

2020
}
2121

22-
/** All implementations of Expr[T] */
22+
/** All implementations of Expr[T].
23+
* These should never be used directly.
24+
*/
2325
object Exprs {
2426
/** An Expr backed by a pickled TASTY tree */
2527
final class TastyExpr[T](val tasty: Pickled, val args: Seq[Any]) extends Expr[T] {
@@ -33,8 +35,8 @@ object Exprs {
3335
override def toString: String = s"Expr($value)"
3436
}
3537

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] {
3840
override def toString: String = s"Expr(<raw>)"
3941
}
4042

library/src/scala/quoted/Type.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ object Type {
2121
implicit def DoubleTag: Type[Double] = new TaggedType[Double]
2222
}
2323

24-
/** Implementations of Type[T] */
24+
/** All implementations of Type[T].
25+
* These should never be used directly.
26+
*/
2527
object Types {
2628
/** A Type backed by a pickled TASTY tree */
2729
final class TastyType[T](val tasty: Pickled, val args: Seq[Any]) extends Type[T] {
@@ -34,7 +36,7 @@ object Types {
3436
}
3537

3638
/** 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] {
3840
override def toString: String = s"Type(<raw>)"
3941
}
4042
}

0 commit comments

Comments
 (0)