Skip to content

Commit 4f769ea

Browse files
committed
Rename Raw{Expr|Type} to Tree{Expr|Type}
1 parent 09bb61f commit 4f769ea

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object PickledQuotes {
3434
def quotedExprToTree(expr: quoted.Expr[_])(implicit ctx: Context): Tree = expr match {
3535
case expr: TastyExpr[_] => unpickleExpr(expr)
3636
case expr: ValueExpr[_] => Literal(Constant(expr.value))
37-
case expr: RawExpr[Tree] @unchecked => expr.tree
37+
case expr: TreeExpr[Tree] @unchecked => expr.tree
3838
case expr: FunctionAppliedTo[_, _] =>
3939
functionAppliedTo(quotedExprToTree(expr.f), quotedExprToTree(expr.x))
4040
}
@@ -43,7 +43,7 @@ object PickledQuotes {
4343
def quotedTypeToTree(expr: quoted.Type[_])(implicit ctx: Context): Tree = expr match {
4444
case expr: TastyType[_] => unpickleType(expr)
4545
case expr: TaggedType[_] => classTagToTypeTree(expr.ct)
46-
case expr: RawType[Tree] @unchecked => expr.tree
46+
case expr: TreeType[Tree] @unchecked => expr.tree
4747
}
4848

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

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

+4-4
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
@@ -1136,12 +1136,12 @@ class TreeUnpickler(reader: TastyReader,
11361136
if (isType) {
11371137
val quotedType =
11381138
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)))
11401140
PickledQuotes.quotedTypeToTree(quotedType)
11411141
} else {
11421142
val quotedExpr =
11431143
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)))
11451145
PickledQuotes.quotedExprToTree(quotedExpr)
11461146
}
11471147

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ class Interpreter(implicit ctx: Context) {
7373

7474
tree match {
7575
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)
7878

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

library/src/scala/quoted/Expr.scala

+5-3
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

+4-2
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)