Skip to content

Commit d307a0b

Browse files
committed
Use tpd.Tree directly
1 parent f477d55 commit d307a0b

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ object PickledQuotes {
3939

4040
/** Transform the expression into its fully spliced Tree */
4141
def quotedExprToTree[T](expr: quoted.Expr[T])(using Context): Tree = {
42-
val expr1 = expr.asInstanceOf[scala.quoted.internal.Expr[Tree]]
42+
val expr1 = expr.asInstanceOf[scala.quoted.internal.Expr]
4343
expr1.checkScopeId(QuoteContextImpl.scopeId)
4444
changeOwnerOfTree(expr1.tree, ctx.owner)
4545
}
4646

4747
/** Transform the expression into its fully spliced TypeTree */
4848
def quotedTypeToTree(tpe: quoted.Type[?])(using Context): Tree = {
49-
val tpe1 = tpe.asInstanceOf[scala.quoted.internal.Type[Tree]]
49+
val tpe1 = tpe.asInstanceOf[scala.quoted.internal.Type]
5050
tpe1.checkScopeId(QuoteContextImpl.scopeId)
5151
changeOwnerOfTree(tpe1.typeTree, ctx.owner)
5252
}

compiler/src/dotty/tools/dotc/quoted/QuoteContextImpl.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern
10031003

10041004
object TypeTree extends TypeTreeModule:
10051005
def of[T <: AnyKind](using tp: scala.quoted.Type[T]): TypeTree =
1006-
tp.asInstanceOf[scala.quoted.internal.Type[TypeTree]].typeTree
1006+
tp.asInstanceOf[scala.quoted.internal.Type].typeTree
10071007
end TypeTree
10081008

10091009
object TypeTreeMethodsImpl extends TypeTreeMethods:
@@ -1572,7 +1572,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern
15721572

15731573
object TypeRepr extends TypeReprModule:
15741574
def of[T <: AnyKind](using tp: scala.quoted.Type[T]): TypeRepr =
1575-
tp.asInstanceOf[scala.quoted.internal.Type[TypeTree]].typeTree.tpe
1575+
tp.asInstanceOf[scala.quoted.internal.Type].typeTree.tpe
15761576
def typeConstructorOf(clazz: Class[?]): TypeRepr =
15771577
if (clazz.isPrimitive)
15781578
if (clazz == classOf[Boolean]) dotc.core.Symbols.defn.BooleanType

compiler/src/scala/quoted/internal/Expr.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@ package scala.quoted.internal
22

33
import scala.quoted._
44

5+
import dotty.tools.dotc.ast.tpd
6+
57
/** An Expr backed by a tree. Only the current compiler trees are allowed.
68
*
79
* These expressions are used for arguments of macros. They contain and actual tree
810
* from the program that is being expanded by the macro.
911
*
1012
* May contain references to code defined outside this Expr instance.
1113
*/
12-
final class Expr[Tree](val tree: Tree, val scopeId: Int) extends scala.quoted.Expr[Any] {
14+
final class Expr(val tree: tpd.Tree, val scopeId: Int) extends scala.quoted.Expr[Any] {
1315
override def equals(that: Any): Boolean = that match {
14-
case that: Expr[_] =>
16+
case that: Expr =>
1517
// Expr are wrappers around trees, therefore they are equals if their trees are equal.
1618
// All scopeId should be equal unless two different runs of the compiler created the trees.
1719
tree == that.tree && scopeId == that.scopeId

compiler/src/scala/quoted/internal/Type.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ package scala.quoted.internal
22

33
import scala.quoted._
44

5+
import dotty.tools.dotc.ast.tpd
6+
57
/** Quoted type (or kind) `T` backed by a tree */
6-
final class Type[Tree](val typeTree: Tree, val scopeId: Int) extends scala.quoted.Type[Any] {
8+
final class Type(val typeTree: tpd.Tree, val scopeId: Int) extends scala.quoted.Type[?] {
79
override def equals(that: Any): Boolean = that match {
8-
case that: Type[_] => typeTree ==
10+
case that: Type => typeTree ==
911
// TastyTreeExpr are wrappers around trees, therfore they are equals if their trees are equal.
1012
// All scopeId should be equal unless two different runs of the compiler created the trees.
1113
that.typeTree && scopeId == that.scopeId

0 commit comments

Comments
 (0)