Skip to content

Commit f8b1c98

Browse files
Merge pull request #10417 from dotty-staging/move-scala-quoted-interanal-to-runtime
Move scala.quoted.internal to scala.quoted.runtime
2 parents 2699974 + 9f409cd commit f8b1c98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+229
-168
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ object desugar {
916916
def quotedPatternTypeDef(tree: TypeDef)(using Context): TypeDef = {
917917
assert(ctx.mode.is(Mode.QuotedPattern))
918918
if tree.name.isVarPattern && !tree.isBackquoted then
919-
val patternTypeAnnot = New(ref(defn.InternalQuotedPatterns_patternTypeAnnot.typeRef)).withSpan(tree.span)
919+
val patternTypeAnnot = New(ref(defn.QuotedRuntimePatterns_patternTypeAnnot.typeRef)).withSpan(tree.span)
920920
val mods = tree.mods.withAddedAnnotation(patternTypeAnnot)
921921
tree.withMods(mods)
922922
else if tree.name.startsWith("$") && !tree.isBackquoted then

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -799,11 +799,11 @@ class Definitions {
799799

800800
@tu lazy val QuoteContextClass: ClassSymbol = requiredClass("scala.quoted.QuoteContext")
801801

802-
@tu lazy val QuoteUnpicklerClass: ClassSymbol = requiredClass("scala.quoted.internal.QuoteUnpickler")
802+
@tu lazy val QuoteUnpicklerClass: ClassSymbol = requiredClass("scala.quoted.runtime.QuoteUnpickler")
803803
@tu lazy val QuoteUnpickler_unpickleExpr: Symbol = QuoteUnpicklerClass.requiredMethod("unpickleExpr")
804804
@tu lazy val QuoteUnpickler_unpickleType: Symbol = QuoteUnpicklerClass.requiredMethod("unpickleType")
805805

806-
@tu lazy val QuoteMatchingClass: ClassSymbol = requiredClass("scala.quoted.internal.QuoteMatching")
806+
@tu lazy val QuoteMatchingClass: ClassSymbol = requiredClass("scala.quoted.runtime.QuoteMatching")
807807
@tu lazy val QuoteMatching_ExprMatch: Symbol = QuoteMatchingClass.requiredMethod("ExprMatch")
808808
@tu lazy val QuoteMatching_TypeMatch: Symbol = QuoteMatchingClass.requiredMethod("TypeMatch")
809809

@@ -818,19 +818,19 @@ class Definitions {
818818
@tu lazy val LiftableModule_CharLiftable: Symbol = LiftableModule.requiredMethod("CharLiftable")
819819
@tu lazy val LiftableModule_StringLiftable: Symbol = LiftableModule.requiredMethod("StringLiftable")
820820

821-
@tu lazy val InternalQuotedModule: Symbol = requiredModule("scala.quoted.internal.Expr")
822-
@tu lazy val InternalQuoted_exprQuote : Symbol = InternalQuotedModule.requiredMethod("quote")
823-
@tu lazy val InternalQuoted_exprSplice : Symbol = InternalQuotedModule.requiredMethod("splice")
824-
@tu lazy val InternalQuoted_exprNestedSplice : Symbol = InternalQuotedModule.requiredMethod("nestedSplice")
821+
@tu lazy val QuotedRuntimeModule: Symbol = requiredModule("scala.quoted.runtime.Expr")
822+
@tu lazy val QuotedRuntime_exprQuote : Symbol = QuotedRuntimeModule.requiredMethod("quote")
823+
@tu lazy val QuotedRuntime_exprSplice : Symbol = QuotedRuntimeModule.requiredMethod("splice")
824+
@tu lazy val QuotedRuntime_exprNestedSplice : Symbol = QuotedRuntimeModule.requiredMethod("nestedSplice")
825825

826-
@tu lazy val InternalQuoted_SplicedTypeAnnot: ClassSymbol = requiredClass("scala.quoted.internal.SplicedType")
826+
@tu lazy val QuotedRuntime_SplicedTypeAnnot: ClassSymbol = requiredClass("scala.quoted.runtime.SplicedType")
827827

828-
@tu lazy val InternalQuotedPatterns: Symbol = requiredModule("scala.quoted.internal.Patterns")
829-
@tu lazy val InternalQuotedPatterns_patternHole: Symbol = InternalQuotedPatterns.requiredMethod("patternHole")
830-
@tu lazy val InternalQuotedPatterns_patternHigherOrderHole: Symbol = InternalQuotedPatterns.requiredMethod("patternHigherOrderHole")
831-
@tu lazy val InternalQuotedPatterns_higherOrderHole: Symbol = InternalQuotedPatterns.requiredMethod("higherOrderHole")
832-
@tu lazy val InternalQuotedPatterns_patternTypeAnnot: ClassSymbol = InternalQuotedPatterns.requiredClass("patternType")
833-
@tu lazy val InternalQuotedPatterns_fromAboveAnnot: ClassSymbol = InternalQuotedPatterns.requiredClass("fromAbove")
828+
@tu lazy val QuotedRuntimePatterns: Symbol = requiredModule("scala.quoted.runtime.Patterns")
829+
@tu lazy val QuotedRuntimePatterns_patternHole: Symbol = QuotedRuntimePatterns.requiredMethod("patternHole")
830+
@tu lazy val QuotedRuntimePatterns_patternHigherOrderHole: Symbol = QuotedRuntimePatterns.requiredMethod("patternHigherOrderHole")
831+
@tu lazy val QuotedRuntimePatterns_higherOrderHole: Symbol = QuotedRuntimePatterns.requiredMethod("higherOrderHole")
832+
@tu lazy val QuotedRuntimePatterns_patternTypeAnnot: ClassSymbol = QuotedRuntimePatterns.requiredClass("patternType")
833+
@tu lazy val QuotedRuntimePatterns_fromAboveAnnot: ClassSymbol = QuotedRuntimePatterns.requiredClass("fromAbove")
834834

835835
@tu lazy val QuotedTypeClass: ClassSymbol = requiredClass("scala.quoted.Type")
836836
@tu lazy val QuotedType_splice: Symbol = QuotedTypeClass.requiredType(tpnme.Underlying)

compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import dotty.tools.dotc.core.Phases.Phase
1111
import dotty.tools.dotc.core.tasty.TastyPrinter
1212
import dotty.tools.io.File
1313

14-
import scala.quoted.internal.impl.QuoteContextImpl
14+
import scala.quoted.runtime.impl.QuoteContextImpl
1515

1616
/** Phase that prints the trees in all loaded compilation units.
1717
*

compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import dotty.tools.dotc.core._
77
import dotty.tools.dotc.core.tasty.TastyHTMLPrinter
88
import dotty.tools.dotc.reporting._
99

10-
import scala.quoted.internal.impl.QuoteContextImpl
10+
import scala.quoted.runtime.impl.QuoteContextImpl
1111

1212
/**
1313
* Decompiler to be used with IDEs

compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ class DecompilerPrinter(_ctx: Context) extends RefinedPrinter(_ctx) {
7474
}
7575

7676
override protected def typeApplyText[T >: Untyped](tree: TypeApply[T]): Text =
77-
if (tree.symbol eq defn.InternalQuoted_exprQuote) "'"
77+
if (tree.symbol eq defn.QuotedRuntime_exprQuote) "'"
7878
else super.typeApplyText(tree)
7979
}

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
389389
changePrec (GlobalPrec) {
390390
keywordStr("throw ") ~ toText(args.head)
391391
}
392-
else if (!printDebug && fun.hasType && fun.symbol == defn.InternalQuoted_exprQuote)
392+
else if (!printDebug && fun.hasType && fun.symbol == defn.QuotedRuntime_exprQuote)
393393
keywordStr("'{") ~ toTextGlobal(args, ", ") ~ keywordStr("}")
394394
else if (!printDebug && fun.hasType && fun.symbol.isExprSplice)
395395
keywordStr("${") ~ toTextGlobal(args, ", ") ~ keywordStr("}")

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import dotty.tools.dotc.report
2020
import scala.reflect.ClassTag
2121

2222
import scala.quoted.QuoteContext
23-
import scala.quoted.internal.impl._
23+
import scala.quoted.runtime.impl._
2424

2525
import scala.collection.mutable
2626

@@ -125,10 +125,10 @@ object PickledQuotes {
125125
/** Replace all type holes generated with the spliced types */
126126
private def spliceTypes(tree: Tree, typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Int], scala.quoted.QuoteContext) => Any)(using Context): Tree = {
127127
tree match
128-
case Block(stat :: rest, expr1) if stat.symbol.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot) =>
128+
case Block(stat :: rest, expr1) if stat.symbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot) =>
129129
val typeSpliceMap = (stat :: rest).iterator.map {
130130
case tdef: TypeDef =>
131-
assert(tdef.symbol.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot))
131+
assert(tdef.symbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot))
132132
val tree = tdef.rhs match
133133
case TypeBoundsTree(_, Hole(_, idx, args), _) =>
134134
val quotedType = typeHole(idx, args)
@@ -143,7 +143,7 @@ object PickledQuotes {
143143
tp.derivedClassInfo(classParents = tp.classParents.map(apply))
144144
case tp: TypeRef =>
145145
typeSpliceMap.get(tp.symbol) match
146-
case Some(t) if tp.typeSymbol.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot) => mapOver(t)
146+
case Some(t) if tp.typeSymbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot) => mapOver(t)
147147
case _ => mapOver(tp)
148148
case _ =>
149149
mapOver(tp)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
174174
tp match
175175
case tp: TypeRef =>
176176
tp.prefix match
177-
case NoPrefix if level > levelOf(tp.symbol) && !tp.typeSymbol.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot) =>
177+
case NoPrefix if level > levelOf(tp.symbol) && !tp.typeSymbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot) =>
178178
val tp1 = tp.dealias
179179
if tp1 != tp then apply(tp1)
180180
else tryHeal(tp.symbol, tp, pos)
@@ -279,7 +279,7 @@ object PCPCheckAndHeal {
279279
flags = Synthetic,
280280
info = TypeAlias(splicedTree.tpe.select(tpnme.Underlying)),
281281
coord = span).asType
282-
local.addAnnotation(Annotation(defn.InternalQuoted_SplicedTypeAnnot))
282+
local.addAnnotation(Annotation(defn.QuotedRuntime_SplicedTypeAnnot))
283283
ctx.typeAssigner.assignType(untpd.TypeDef(local.name, alias), local)
284284
}
285285

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class PickleQuotes extends MacroTransform {
8282
assert(!tree.symbol.isQuote)
8383
assert(!tree.symbol.isExprSplice)
8484
case _ : TypeDef =>
85-
assert(!tree.symbol.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot),
85+
assert(!tree.symbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot),
8686
s"${tree.symbol} should have been removed by PickledQuotes because it has a @quoteTypeTag")
8787
case _ =>
8888
}
@@ -481,7 +481,7 @@ class PickleQuotes extends MacroTransform {
481481
if (tree.isType)
482482
transformSpliceType(body, body.select(tpnme.Underlying))
483483
else
484-
val splice = ref(defn.InternalQuoted_exprSplice).appliedToType(tree.tpe).appliedTo(body)
484+
val splice = ref(defn.QuotedRuntime_exprSplice).appliedToType(tree.tpe).appliedTo(body)
485485
transformSplice(body, splice)
486486

487487
case tree: DefDef if tree.symbol.is(Macro) && level == 0 =>

0 commit comments

Comments
 (0)