Skip to content

Fix #10222: Move scala.quoted.internal to scala.quoted.internal #10281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -795,11 +795,14 @@ class Definitions {
@tu lazy val QuotedExprModule: Symbol = QuotedExprClass.companionModule

@tu lazy val QuoteContextClass: ClassSymbol = requiredClass("scala.quoted.QuoteContext")
@tu lazy val QuoteContextInternalClass: ClassSymbol = requiredClass("scala.internal.quoted.QuoteContextInternal")
@tu lazy val QuoteContextInternal_unpickleExpr: Symbol = QuoteContextInternalClass.requiredMethod("unpickleExpr")
@tu lazy val QuoteContextInternal_unpickleType: Symbol = QuoteContextInternalClass.requiredMethod("unpickleType")
@tu lazy val QuoteContextInternal_ExprMatch: Symbol = QuoteContextInternalClass.requiredMethod("ExprMatch")
@tu lazy val QuoteContextInternal_TypeMatch: Symbol = QuoteContextInternalClass.requiredMethod("TypeMatch")

@tu lazy val QuoteUnpicklerClass: ClassSymbol = requiredClass("scala.quoted.internal.QuoteUnpickler")
@tu lazy val QuoteUnpickler_unpickleExpr: Symbol = QuoteUnpicklerClass.requiredMethod("unpickleExpr")
@tu lazy val QuoteUnpickler_unpickleType: Symbol = QuoteUnpicklerClass.requiredMethod("unpickleType")

@tu lazy val QuoteMatchingClass: ClassSymbol = requiredClass("scala.quoted.internal.QuoteMatching")
@tu lazy val QuoteMatching_ExprMatch: Symbol = QuoteMatchingClass.requiredMethod("ExprMatch")
@tu lazy val QuoteMatching_TypeMatch: Symbol = QuoteMatchingClass.requiredMethod("TypeMatch")

@tu lazy val LiftableModule: Symbol = requiredModule("scala.quoted.Liftable")
@tu lazy val LiftableModule_BooleanLiftable: Symbol = LiftableModule.requiredMethod("BooleanLiftable")
Expand All @@ -812,13 +815,14 @@ class Definitions {
@tu lazy val LiftableModule_CharLiftable: Symbol = LiftableModule.requiredMethod("CharLiftable")
@tu lazy val LiftableModule_StringLiftable: Symbol = LiftableModule.requiredMethod("StringLiftable")

@tu lazy val InternalQuotedModule: Symbol = requiredModule("scala.internal.quoted.CompileTime")
@tu lazy val InternalQuoted_exprQuote : Symbol = InternalQuotedModule.requiredMethod("exprQuote")
@tu lazy val InternalQuoted_exprSplice : Symbol = InternalQuotedModule.requiredMethod("exprSplice")
@tu lazy val InternalQuoted_exprNestedSplice : Symbol = InternalQuotedModule.requiredMethod("exprNestedSplice")
@tu lazy val InternalQuoted_QuoteTypeTagAnnot: ClassSymbol = InternalQuotedModule.requiredClass("quoteTypeTag")
@tu lazy val InternalQuotedModule: Symbol = requiredModule("scala.quoted.internal.Expr")
@tu lazy val InternalQuoted_exprQuote : Symbol = InternalQuotedModule.requiredMethod("quote")
@tu lazy val InternalQuoted_exprSplice : Symbol = InternalQuotedModule.requiredMethod("splice")
@tu lazy val InternalQuoted_exprNestedSplice : Symbol = InternalQuotedModule.requiredMethod("nestedSplice")

@tu lazy val InternalQuoted_SplicedTypeAnnot: ClassSymbol = requiredClass("scala.quoted.internal.SplicedType")

@tu lazy val InternalQuotedPatterns: Symbol = requiredModule("scala.internal.quoted.Patterns")
@tu lazy val InternalQuotedPatterns: Symbol = requiredModule("scala.quoted.internal.Patterns")
@tu lazy val InternalQuotedPatterns_patternHole: Symbol = InternalQuotedPatterns.requiredMethod("patternHole")
@tu lazy val InternalQuotedPatterns_patternHigherOrderHole: Symbol = InternalQuotedPatterns.requiredMethod("patternHigherOrderHole")
@tu lazy val InternalQuotedPatterns_higherOrderHole: Symbol = InternalQuotedPatterns.requiredMethod("higherOrderHole")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package scala.quoted.internal
package dotty.tools.dotc.quoted

import scala.quoted._

Expand All @@ -11,9 +11,9 @@ import dotty.tools.dotc.ast.tpd
*
* May contain references to code defined outside this Expr instance.
*/
final class Expr(val tree: tpd.Tree, val scopeId: Int) extends scala.quoted.Expr[Any] {
final class ExprImpl(val tree: tpd.Tree, val scopeId: Int) extends scala.quoted.internal.Expr[Any] {
override def equals(that: Any): Boolean = that match {
case that: Expr =>
case that: ExprImpl =>
// Expr are wrappers around trees, therefore they are equals if their trees are equal.
// All scopeId should be equal unless two different runs of the compiler created the trees.
tree == that.tree && scopeId == that.scopeId
Expand Down
14 changes: 7 additions & 7 deletions compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ object PickledQuotes {

/** Transform the expression into its fully spliced Tree */
def quotedExprToTree[T](expr: quoted.Expr[T])(using Context): Tree = {
val expr1 = expr.asInstanceOf[scala.quoted.internal.Expr]
val expr1 = expr.asInstanceOf[dotty.tools.dotc.quoted.ExprImpl]
expr1.checkScopeId(QuoteContextImpl.scopeId)
changeOwnerOfTree(expr1.tree, ctx.owner)
}

/** Transform the expression into its fully spliced TypeTree */
def quotedTypeToTree(tpe: quoted.Type[?])(using Context): Tree = {
val tpe1 = tpe.asInstanceOf[scala.quoted.internal.Type]
val tpe1 = tpe.asInstanceOf[dotty.tools.dotc.quoted.TypeImpl]
tpe1.checkScopeId(QuoteContextImpl.scopeId)
changeOwnerOfTree(tpe1.typeTree, ctx.owner)
}
Expand All @@ -72,8 +72,8 @@ object PickledQuotes {
override def transform(tree: tpd.Tree)(using Context): tpd.Tree = tree match {
case Hole(isTerm, idx, args) =>
val reifiedArgs = args.map { arg =>
if (arg.isTerm) (using qctx: QuoteContext) => new scala.quoted.internal.Expr(arg, QuoteContextImpl.scopeId)
else new scala.quoted.internal.Type(arg, QuoteContextImpl.scopeId)
if (arg.isTerm) (using qctx: QuoteContext) => new dotty.tools.dotc.quoted.ExprImpl(arg, QuoteContextImpl.scopeId)
else new dotty.tools.dotc.quoted.TypeImpl(arg, QuoteContextImpl.scopeId)
}
if isTerm then
val quotedExpr = termHole(idx, reifiedArgs, dotty.tools.dotc.quoted.QuoteContextImpl())
Expand Down Expand Up @@ -123,10 +123,10 @@ object PickledQuotes {
/** Replace all type holes generated with the spliced types */
private def spliceTypes(tree: Tree, typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Int], scala.quoted.QuoteContext) => Any)(using Context): Tree = {
tree match
case Block(stat :: rest, expr1) if stat.symbol.hasAnnotation(defn.InternalQuoted_QuoteTypeTagAnnot) =>
case Block(stat :: rest, expr1) if stat.symbol.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot) =>
val typeSpliceMap = (stat :: rest).iterator.map {
case tdef: TypeDef =>
assert(tdef.symbol.hasAnnotation(defn.InternalQuoted_QuoteTypeTagAnnot))
assert(tdef.symbol.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot))
val tree = tdef.rhs match
case TypeBoundsTree(_, Hole(_, idx, args), _) =>
val quotedType = typeHole(idx, args)
Expand All @@ -141,7 +141,7 @@ object PickledQuotes {
tp.derivedClassInfo(classParents = tp.classParents.map(apply))
case tp: TypeRef =>
typeSpliceMap.get(tp.symbol) match
case Some(t) if tp.typeSymbol.hasAnnotation(defn.InternalQuoted_QuoteTypeTagAnnot) => mapOver(t)
case Some(t) if tp.typeSymbol.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot) => mapOver(t)
case _ => mapOver(tp)
case _ =>
mapOver(tp)
Expand Down
19 changes: 10 additions & 9 deletions compiler/src/dotty/tools/dotc/quoted/QuoteContextImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import dotty.tools.dotc.quoted.QuoteUtils._
import dotty.tools.dotc.core.Decorators._

import scala.quoted.QuoteContext
import scala.quoted.internal.{QuoteUnpickler, QuoteMatching}
import dotty.tools.dotc.quoted.printers.{Extractors, SourceCode, SyntaxHighlight}

import scala.tasty.reflect._
Expand All @@ -40,7 +41,7 @@ object QuoteContextImpl {

}

class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.internal.quoted.QuoteContextInternal:
class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickler, QuoteMatching:

object reflect extends scala.tasty.Reflection:

Expand Down Expand Up @@ -71,7 +72,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern
case _ => false
def asExpr: scala.quoted.Expr[Any] =
if self.isExpr then
new scala.quoted.internal.Expr(self, QuoteContextImpl.this.hashCode)
new dotty.tools.dotc.quoted.ExprImpl(self, QuoteContextImpl.this.hashCode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new dotty.tools.dotc.quoted.ExprImpl(self, QuoteContextImpl.this.hashCode)
new ExprImpl(self, QuoteContextImpl.this.hashCode)

else self match
case TermTypeTest(self) => throw new Exception("Expected an expression. This is a partially applied Term. Try eta-expanding the term first.")
case _ => throw new Exception("Expected a Term but was: " + self)
Expand Down Expand Up @@ -315,11 +316,11 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern
object TermMethodsImpl extends TermMethods:
extension (self: Term):
def seal: scala.quoted.Expr[Any] =
if self.isExpr then new scala.quoted.internal.Expr(self, QuoteContextImpl.this.hashCode)
if self.isExpr then new dotty.tools.dotc.quoted.ExprImpl(self, QuoteContextImpl.this.hashCode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if self.isExpr then new dotty.tools.dotc.quoted.ExprImpl(self, QuoteContextImpl.this.hashCode)
if self.isExpr then new ExprImpl(self, QuoteContextImpl.this.hashCode)

else throw new Exception("Cannot seal a partially applied Term. Try eta-expanding the term first.")

def sealOpt: Option[scala.quoted.Expr[Any]] =
if self.isExpr then Some(new scala.quoted.internal.Expr(self, QuoteContextImpl.this.hashCode))
if self.isExpr then Some(new dotty.tools.dotc.quoted.ExprImpl(self, QuoteContextImpl.this.hashCode))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if self.isExpr then Some(new dotty.tools.dotc.quoted.ExprImpl(self, QuoteContextImpl.this.hashCode))
if self.isExpr then Some(new ExprImpl(self, QuoteContextImpl.this.hashCode))

else None

def tpe: TypeRepr = self.tpe
Expand Down Expand Up @@ -1002,7 +1003,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern

object TypeTree extends TypeTreeModule:
def of[T <: AnyKind](using tp: scala.quoted.Type[T]): TypeTree =
tp.asInstanceOf[scala.quoted.internal.Type].typeTree
tp.asInstanceOf[dotty.tools.dotc.quoted.TypeImpl].typeTree
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tp.asInstanceOf[dotty.tools.dotc.quoted.TypeImpl].typeTree
tp.asInstanceOf[TypeImpl].typeTree

end TypeTree

object TypeTreeMethodsImpl extends TypeTreeMethods:
Expand Down Expand Up @@ -1571,7 +1572,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern

object TypeRepr extends TypeReprModule:
def of[T <: AnyKind](using tp: scala.quoted.Type[T]): TypeRepr =
tp.asInstanceOf[scala.quoted.internal.Type].typeTree.tpe
tp.asInstanceOf[dotty.tools.dotc.quoted.TypeImpl].typeTree.tpe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tp.asInstanceOf[dotty.tools.dotc.quoted.TypeImpl].typeTree.tpe
tp.asInstanceOf[TypeImpl].typeTree.tpe

def typeConstructorOf(clazz: Class[?]): TypeRepr =
if (clazz.isPrimitive)
if (clazz == classOf[Boolean]) dotc.core.Symbols.defn.BooleanType
Expand Down Expand Up @@ -1608,7 +1609,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern
def seal: scala.quoted.Type[_] = self.asType

def asType: scala.quoted.Type[?] =
new scala.quoted.internal.Type(Inferred(self), QuoteContextImpl.this.hashCode)
new dotty.tools.dotc.quoted.TypeImpl(Inferred(self), QuoteContextImpl.this.hashCode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new dotty.tools.dotc.quoted.TypeImpl(Inferred(self), QuoteContextImpl.this.hashCode)
new TypeImpl(Inferred(self), QuoteContextImpl.this.hashCode)


def =:=(that: TypeRepr): Boolean = self =:= that
def <:<(that: TypeRepr): Boolean = self <:< that
Expand Down Expand Up @@ -2623,11 +2624,11 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern

def unpickleExpr[T](pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.QuoteContext) => scala.quoted.Expr[?]): scala.quoted.Expr[T] =
val tree = PickledQuotes.unpickleTerm(pickled, typeHole, termHole)(using reflect.rootContext)
new scala.quoted.internal.Expr(tree, hash).asInstanceOf[scala.quoted.Expr[T]]
new dotty.tools.dotc.quoted.ExprImpl(tree, hash).asInstanceOf[scala.quoted.Expr[T]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new dotty.tools.dotc.quoted.ExprImpl(tree, hash).asInstanceOf[scala.quoted.Expr[T]]
new ExprImpl(tree, hash).asInstanceOf[scala.quoted.Expr[T]]


def unpickleType[T <: AnyKind](pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.QuoteContext) => scala.quoted.Expr[?]): scala.quoted.Type[T] =
val tree = PickledQuotes.unpickleTypeTree(pickled, typeHole, termHole)(using reflect.rootContext)
new scala.quoted.internal.Type(tree, hash).asInstanceOf[scala.quoted.Type[T]]
new dotty.tools.dotc.quoted.TypeImpl(tree, hash).asInstanceOf[scala.quoted.Type[T]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new dotty.tools.dotc.quoted.TypeImpl(tree, hash).asInstanceOf[scala.quoted.Type[T]]
new TypeImpl(tree, hash).asInstanceOf[scala.quoted.Type[T]]


object ExprMatch extends ExprMatchModule:
def unapply[TypeBindings <: Tuple, Tup <: Tuple](scrutinee: scala.quoted.Expr[Any])(using pattern: scala.quoted.Expr[Any]): Option[Tup] =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package scala.quoted.internal
package dotty.tools.dotc.quoted

class ScopeException(msg: String) extends Exception(msg)
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package scala.quoted.internal
package dotty.tools.dotc.quoted

import scala.quoted._

import dotty.tools.dotc.ast.tpd

/** Quoted type (or kind) `T` backed by a tree */
final class Type(val typeTree: tpd.Tree, val scopeId: Int) extends scala.quoted.Type[?] {
final class TypeImpl(val typeTree: tpd.Tree, val scopeId: Int) extends scala.quoted.internal.Type[?] {
override def equals(that: Any): Boolean = that match {
case that: Type => typeTree ==
case that: TypeImpl => typeTree ==
// TastyTreeExpr are wrappers around trees, therfore they are equals if their trees are equal.
// All scopeId should be equal unless two different runs of the compiler created the trees.
that.typeTree && scopeId == that.scopeId
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/transform/PCPCheckAndHeal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
tp match
case tp: TypeRef =>
tp.prefix match
case NoPrefix if level > levelOf(tp.symbol) && !tp.typeSymbol.hasAnnotation(defn.InternalQuoted_QuoteTypeTagAnnot) =>
case NoPrefix if level > levelOf(tp.symbol) && !tp.typeSymbol.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot) =>
val tp1 = tp.dealias
if tp1 != tp then apply(tp1)
else tryHeal(tp.symbol, tp, pos)
Expand Down Expand Up @@ -279,7 +279,7 @@ object PCPCheckAndHeal {
flags = Synthetic,
info = TypeAlias(splicedTree.tpe.select(tpnme.Underlying)),
coord = span).asType
local.addAnnotation(Annotation(defn.InternalQuoted_QuoteTypeTagAnnot))
local.addAnnotation(Annotation(defn.InternalQuoted_SplicedTypeAnnot))
ctx.typeAssigner.assignType(untpd.TypeDef(local.name, alias), local)
}

Expand Down
10 changes: 5 additions & 5 deletions compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class PickleQuotes extends MacroTransform {
assert(!tree.symbol.isQuote)
assert(!tree.symbol.isExprSplice)
case _ : TypeDef =>
assert(!tree.symbol.hasAnnotation(defn.InternalQuoted_QuoteTypeTagAnnot),
assert(!tree.symbol.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot),
s"${tree.symbol} should have been removed by PickledQuotes because it has a @quoteTypeTag")
case _ =>
}
Expand Down Expand Up @@ -193,11 +193,11 @@ class PickleQuotes extends MacroTransform {
}
}

/** Encode quote using QuoteContextInternal.{unpickleExpr, unpickleType}
/** Encode quote using QuoteUnpickler.{unpickleExpr, unpickleType}
*
* Generate the code
* ```scala
* qctx => qctx.asInstanceOf[QuoteContextInternal].<unpickleExpr|unpickleType>[<type>](
* qctx => qctx.asInstanceOf[QuoteUnpickler].<unpickleExpr|unpickleType>[<type>](
* <pickledQuote>,
* <typeHole>,
* <termHole>,
Expand Down Expand Up @@ -255,8 +255,8 @@ class PickleQuotes extends MacroTransform {
val quotedType = quoteClass.typeRef.appliedTo(originalTp)
val lambdaTpe = MethodType(defn.QuoteContextClass.typeRef :: Nil, quotedType)
def callUnpickle(ts: List[Tree]) = {
val qctx = ts.head.asInstance(defn.QuoteContextInternalClass.typeRef)
val unpickleMeth = if isType then defn.QuoteContextInternal_unpickleType else defn.QuoteContextInternal_unpickleExpr
val qctx = ts.head.asInstance(defn.QuoteUnpicklerClass.typeRef)
val unpickleMeth = if isType then defn.QuoteUnpickler_unpickleType else defn.QuoteUnpickler_unpickleExpr
qctx.select(unpickleMeth).appliedToType(originalTp).appliedTo(pickledQuoteStrings, typeHoles, termHoles)
}
Lambda(lambdaTpe, callUnpickle).withSpan(body.span)
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/transform/Splicer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,10 @@ object Splicer {
}

private def interpretQuote(tree: Tree)(implicit env: Env): Object =
new scala.quoted.internal.Expr(Inlined(EmptyTree, Nil, QuoteUtils.changeOwnerOfTree(tree, ctx.owner)).withSpan(tree.span), QuoteContextImpl.scopeId)
new dotty.tools.dotc.quoted.ExprImpl(Inlined(EmptyTree, Nil, QuoteUtils.changeOwnerOfTree(tree, ctx.owner)).withSpan(tree.span), QuoteContextImpl.scopeId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new dotty.tools.dotc.quoted.ExprImpl(Inlined(EmptyTree, Nil, QuoteUtils.changeOwnerOfTree(tree, ctx.owner)).withSpan(tree.span), QuoteContextImpl.scopeId)
new quoted.ExprImpl(Inlined(EmptyTree, Nil, QuoteUtils.changeOwnerOfTree(tree, ctx.owner)).withSpan(tree.span), QuoteContextImpl.scopeId)


private def interpretTypeQuote(tree: Tree)(implicit env: Env): Object =
new scala.quoted.internal.Type(QuoteUtils.changeOwnerOfTree(tree, ctx.owner), QuoteContextImpl.scopeId)
new dotty.tools.dotc.quoted.TypeImpl(QuoteUtils.changeOwnerOfTree(tree, ctx.owner), QuoteContextImpl.scopeId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new dotty.tools.dotc.quoted.TypeImpl(QuoteUtils.changeOwnerOfTree(tree, ctx.owner), QuoteContextImpl.scopeId)
new quoted.TypeImpl(QuoteUtils.changeOwnerOfTree(tree, ctx.owner), QuoteContextImpl.scopeId)


private def interpretLiteral(value: Any)(implicit env: Env): Object =
value.asInstanceOf[Object]
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/Staging.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Staging extends MacroTransform {
else i"${sym.name}.this"
val errMsg = s"\nin ${ctx.owner.fullName}"
assert(
ctx.owner.hasAnnotation(defn.InternalQuoted_QuoteTypeTagAnnot) ||
ctx.owner.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot) ||
(sym.isType && levelOf(sym) > 0),
em"""access to $symStr from wrong staging level:
| - the definition is at level ${levelOf(sym)},
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ trait QuotesAndSplices {
if (tree.quoted.isTerm) ref(defn.InternalQuoted_exprQuote.termRef).appliedToType(defn.AnyType).appliedTo(shape).select(nme.apply).appliedTo(qctx)
else ref(defn.QuotedTypeModule_apply.termRef).appliedToTypeTree(shape).select(nme.apply).appliedTo(qctx)

val matchModule = if tree.quoted.isTerm then defn.QuoteContextInternal_ExprMatch else defn.QuoteContextInternal_TypeMatch
val unapplyFun = qctx.asInstance(defn.QuoteContextInternalClass.typeRef).select(matchModule).select(nme.unapply)
val matchModule = if tree.quoted.isTerm then defn.QuoteMatching_ExprMatch else defn.QuoteMatching_TypeMatch
val unapplyFun = qctx.asInstance(defn.QuoteMatchingClass.typeRef).select(matchModule).select(nme.unapply)

UnApply(
fun = unapplyFun.appliedToTypeTrees(typeBindingsTuple :: TypeTree(patType) :: Nil),
Expand Down
34 changes: 0 additions & 34 deletions library/src-bootstrapped/scala/internal/quoted/CompileTime.scala

This file was deleted.

2 changes: 1 addition & 1 deletion library/src-bootstrapped/scala/quoted/Expr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class Expr[+T] private[scala] {
* ```
*/
final def matches(that: Expr[Any])(using qctx: QuoteContext): Boolean =
val ExprMatch = qctx.asInstanceOf[scala.internal.quoted.QuoteContextInternal].ExprMatch
val ExprMatch = qctx.asInstanceOf[scala.quoted.internal.QuoteMatching].ExprMatch
ExprMatch.unapply[EmptyTuple, EmptyTuple](this)(using that).nonEmpty

/** Checks is the `quoted.Expr[?]` is valid expression of type `X` */
Expand Down
11 changes: 0 additions & 11 deletions library/src-non-bootstrapped/scala/quoted/QuoteContext.scala

This file was deleted.

Loading