Skip to content

Commit f477d55

Browse files
committed
Move internal Expr and Type implementations into the compiler
1 parent 819e0b1 commit f477d55

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

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

Lines changed: 4 additions & 4 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.internal.quoted.Expr[Tree]]
42+
val expr1 = expr.asInstanceOf[scala.quoted.internal.Expr[Tree]]
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.internal.quoted.Type[Tree]]
49+
val tpe1 = tpe.asInstanceOf[scala.quoted.internal.Type[Tree]]
5050
tpe1.checkScopeId(QuoteContextImpl.scopeId)
5151
changeOwnerOfTree(tpe1.typeTree, ctx.owner)
5252
}
@@ -75,8 +75,8 @@ object PickledQuotes {
7575
override def transform(tree: tpd.Tree)(using Context): tpd.Tree = tree match {
7676
case Hole(isTerm, idx, args) =>
7777
val reifiedArgs = args.map { arg =>
78-
if (arg.isTerm) (using qctx: QuoteContext) => new scala.internal.quoted.Expr(arg, QuoteContextImpl.scopeId)
79-
else new scala.internal.quoted.Type(arg, QuoteContextImpl.scopeId)
78+
if (arg.isTerm) (using qctx: QuoteContext) => new scala.quoted.internal.Expr(arg, QuoteContextImpl.scopeId)
79+
else new scala.quoted.internal.Type(arg, QuoteContextImpl.scopeId)
8080
}
8181
if isTerm then
8282
val quotedExpr = pickledQuote.exprSplice(idx)(reifiedArgs)(dotty.tools.dotc.quoted.QuoteContextImpl())

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern
7272
case _ => false
7373
def asExpr: scala.quoted.Expr[Any] =
7474
if self.isExpr then
75-
new scala.internal.quoted.Expr(self, QuoteContextImpl.this.hashCode)
75+
new scala.quoted.internal.Expr(self, QuoteContextImpl.this.hashCode)
7676
else self match
7777
case TermTypeTest(self) => throw new Exception("Expected an expression. This is a partially applied Term. Try eta-expanding the term first.")
7878
case _ => throw new Exception("Expected a Term but was: " + self)
@@ -316,11 +316,11 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern
316316
object TermMethodsImpl extends TermMethods:
317317
extension (self: Term):
318318
def seal: scala.quoted.Expr[Any] =
319-
if self.isExpr then new scala.internal.quoted.Expr(self, QuoteContextImpl.this.hashCode)
319+
if self.isExpr then new scala.quoted.internal.Expr(self, QuoteContextImpl.this.hashCode)
320320
else throw new Exception("Cannot seal a partially applied Term. Try eta-expanding the term first.")
321321

322322
def sealOpt: Option[scala.quoted.Expr[Any]] =
323-
if self.isExpr then Some(new scala.internal.quoted.Expr(self, QuoteContextImpl.this.hashCode))
323+
if self.isExpr then Some(new scala.quoted.internal.Expr(self, QuoteContextImpl.this.hashCode))
324324
else None
325325

326326
def tpe: TypeRepr = self.tpe
@@ -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.internal.quoted.Type[TypeTree]].typeTree
1006+
tp.asInstanceOf[scala.quoted.internal.Type[TypeTree]].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.internal.quoted.Type[TypeTree]].typeTree.tpe
1575+
tp.asInstanceOf[scala.quoted.internal.Type[TypeTree]].typeTree.tpe
15761576
def typeConstructorOf(clazz: Class[?]): TypeRepr =
15771577
if (clazz.isPrimitive)
15781578
if (clazz == classOf[Boolean]) dotc.core.Symbols.defn.BooleanType
@@ -1609,7 +1609,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern
16091609
def seal: scala.quoted.Type[_] = self.asType
16101610

16111611
def asType: scala.quoted.Type[?] =
1612-
new scala.internal.quoted.Type(Inferred(self), QuoteContextImpl.this.hashCode)
1612+
new scala.quoted.internal.Type(Inferred(self), QuoteContextImpl.this.hashCode)
16131613

16141614
def =:=(that: TypeRepr): Boolean = self =:= that
16151615
def <:<(that: TypeRepr): Boolean = self <:< that
@@ -2633,11 +2633,11 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern
26332633

26342634
def unpickleExpr[T](pickledQuote: PickledQuote): scala.quoted.Expr[T] =
26352635
val tree = PickledQuotes.unpickleTerm(pickledQuote)(using reflect.rootContext)
2636-
new scala.internal.quoted.Expr(tree, hash).asInstanceOf[scala.quoted.Expr[T]]
2636+
new scala.quoted.internal.Expr(tree, hash).asInstanceOf[scala.quoted.Expr[T]]
26372637

26382638
def unpickleType[T <: AnyKind](pickledQuote: PickledQuote): scala.quoted.Type[T] =
26392639
val tree = PickledQuotes.unpickleTypeTree(pickledQuote)(using reflect.rootContext)
2640-
new scala.internal.quoted.Type(tree, hash).asInstanceOf[scala.quoted.Type[T]]
2640+
new scala.quoted.internal.Type(tree, hash).asInstanceOf[scala.quoted.Type[T]]
26412641

26422642
object ExprMatch extends ExprMatchModule:
26432643
def unapply[TypeBindings <: Tuple, Tup <: Tuple](scrutinee: scala.quoted.Expr[Any])(using pattern: scala.quoted.Expr[Any]): Option[Tup] =

compiler/src/dotty/tools/dotc/transform/Splicer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,10 @@ object Splicer {
323323
}
324324

325325
private def interpretQuote(tree: Tree)(implicit env: Env): Object =
326-
new scala.internal.quoted.Expr(Inlined(EmptyTree, Nil, QuoteUtils.changeOwnerOfTree(tree, ctx.owner)).withSpan(tree.span), QuoteContextImpl.scopeId)
326+
new scala.quoted.internal.Expr(Inlined(EmptyTree, Nil, QuoteUtils.changeOwnerOfTree(tree, ctx.owner)).withSpan(tree.span), QuoteContextImpl.scopeId)
327327

328328
private def interpretTypeQuote(tree: Tree)(implicit env: Env): Object =
329-
new scala.internal.quoted.Type(QuoteUtils.changeOwnerOfTree(tree, ctx.owner), QuoteContextImpl.scopeId)
329+
new scala.quoted.internal.Type(QuoteUtils.changeOwnerOfTree(tree, ctx.owner), QuoteContextImpl.scopeId)
330330

331331
private def interpretLiteral(value: Any)(implicit env: Env): Object =
332332
value.asInstanceOf[Object]

library/src-bootstrapped/scala/internal/quoted/Expr.scala renamed to compiler/src/scala/quoted/internal/Expr.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package scala.internal.quoted
1+
package scala.quoted.internal
22

33
import scala.quoted._
44

library/src-bootstrapped/scala/internal/quoted/Type.scala renamed to compiler/src/scala/quoted/internal/Type.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package scala.internal.quoted
1+
package scala.quoted.internal
22

33
import scala.quoted._
44

0 commit comments

Comments
 (0)