Skip to content

Commit 7aa8f95

Browse files
committed
Rename Raw{Expr|Type} to Tree{Expr|Type}
1 parent 097feb4 commit 7aa8f95

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
@@ -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

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
@@ -1102,12 +1102,12 @@ class TreeUnpickler(reader: TastyReader,
11021102
if (isType) {
11031103
val quotedType =
11041104
if (args.isEmpty) splice.asInstanceOf[quoted.Type[_]]
1105-
else splice.asInstanceOf[Seq[Any] => quoted.Type[_]](args.map(tree => new RawType(tree)))
1105+
else splice.asInstanceOf[Seq[Any] => quoted.Type[_]](args.map(tree => new TreeType(tree)))
11061106
PickledQuotes.quotedTypeToTree(quotedType)
11071107
} else {
11081108
val quotedExpr =
11091109
if (args.isEmpty) splice.asInstanceOf[quoted.Expr[_]]
1110-
else splice.asInstanceOf[Seq[Any] => quoted.Expr[_]](args.map(tree => new RawExpr(tree)))
1110+
else splice.asInstanceOf[Seq[Any] => quoted.Expr[_]](args.map(tree => new TreeExpr(tree)))
11111111
PickledQuotes.quotedExprToTree(quotedExpr)
11121112
}
11131113

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

Lines changed: 2 additions & 2 deletions
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

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)