diff --git a/community-build/community-projects/shapeless b/community-build/community-projects/shapeless index 88f9c05ac95c..1e4d28e12755 160000 --- a/community-build/community-projects/shapeless +++ b/community-build/community-projects/shapeless @@ -1 +1 @@ -Subproject commit 88f9c05ac95c8ed0d597a3670c568fcc3c2bfc66 +Subproject commit 1e4d28e12755ede23e8e2e3ad6077e69bd4d4e8e diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 8b08766b610c..44ff10de143c 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -916,7 +916,7 @@ object desugar { def quotedPatternTypeDef(tree: TypeDef)(using Context): TypeDef = { assert(ctx.mode.is(Mode.QuotedPattern)) if tree.name.isVarPattern && !tree.isBackquoted then - val patternTypeAnnot = New(ref(defn.InternalQuotedPatterns_patternTypeAnnot.typeRef)).withSpan(tree.span) + val patternTypeAnnot = New(ref(defn.QuotedRuntimePatterns_patternTypeAnnot.typeRef)).withSpan(tree.span) val mods = tree.mods.withAddedAnnotation(patternTypeAnnot) tree.withMods(mods) else if tree.name.startsWith("$") && !tree.isBackquoted then diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index c33bd521d206..d2807152ddf8 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -799,11 +799,11 @@ class Definitions { @tu lazy val QuoteContextClass: ClassSymbol = requiredClass("scala.quoted.QuoteContext") - @tu lazy val QuoteUnpicklerClass: ClassSymbol = requiredClass("scala.quoted.internal.QuoteUnpickler") + @tu lazy val QuoteUnpicklerClass: ClassSymbol = requiredClass("scala.quoted.runtime.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 QuoteMatchingClass: ClassSymbol = requiredClass("scala.quoted.runtime.QuoteMatching") @tu lazy val QuoteMatching_ExprMatch: Symbol = QuoteMatchingClass.requiredMethod("ExprMatch") @tu lazy val QuoteMatching_TypeMatch: Symbol = QuoteMatchingClass.requiredMethod("TypeMatch") @@ -818,19 +818,19 @@ 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.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 QuotedRuntimeModule: Symbol = requiredModule("scala.quoted.runtime.Expr") + @tu lazy val QuotedRuntime_exprQuote : Symbol = QuotedRuntimeModule.requiredMethod("quote") + @tu lazy val QuotedRuntime_exprSplice : Symbol = QuotedRuntimeModule.requiredMethod("splice") + @tu lazy val QuotedRuntime_exprNestedSplice : Symbol = QuotedRuntimeModule.requiredMethod("nestedSplice") - @tu lazy val InternalQuoted_SplicedTypeAnnot: ClassSymbol = requiredClass("scala.quoted.internal.SplicedType") + @tu lazy val QuotedRuntime_SplicedTypeAnnot: ClassSymbol = requiredClass("scala.quoted.runtime.SplicedType") - @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") - @tu lazy val InternalQuotedPatterns_patternTypeAnnot: ClassSymbol = InternalQuotedPatterns.requiredClass("patternType") - @tu lazy val InternalQuotedPatterns_fromAboveAnnot: ClassSymbol = InternalQuotedPatterns.requiredClass("fromAbove") + @tu lazy val QuotedRuntimePatterns: Symbol = requiredModule("scala.quoted.runtime.Patterns") + @tu lazy val QuotedRuntimePatterns_patternHole: Symbol = QuotedRuntimePatterns.requiredMethod("patternHole") + @tu lazy val QuotedRuntimePatterns_patternHigherOrderHole: Symbol = QuotedRuntimePatterns.requiredMethod("patternHigherOrderHole") + @tu lazy val QuotedRuntimePatterns_higherOrderHole: Symbol = QuotedRuntimePatterns.requiredMethod("higherOrderHole") + @tu lazy val QuotedRuntimePatterns_patternTypeAnnot: ClassSymbol = QuotedRuntimePatterns.requiredClass("patternType") + @tu lazy val QuotedRuntimePatterns_fromAboveAnnot: ClassSymbol = QuotedRuntimePatterns.requiredClass("fromAbove") @tu lazy val QuotedTypeClass: ClassSymbol = requiredClass("scala.quoted.Type") @tu lazy val QuotedType_splice: Symbol = QuotedTypeClass.requiredType(tpnme.Underlying) diff --git a/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala b/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala index 4b397d32ba4f..5f713d8db469 100644 --- a/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala +++ b/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala @@ -11,7 +11,7 @@ import dotty.tools.dotc.core.Phases.Phase import dotty.tools.dotc.core.tasty.TastyPrinter import dotty.tools.io.File -import scala.quoted.internal.impl.QuoteContextImpl +import scala.quoted.runtime.impl.QuoteContextImpl /** Phase that prints the trees in all loaded compilation units. * diff --git a/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala b/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala index d1afda1e99a8..68c5a2c87e56 100644 --- a/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala +++ b/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala @@ -7,7 +7,7 @@ import dotty.tools.dotc.core._ import dotty.tools.dotc.core.tasty.TastyHTMLPrinter import dotty.tools.dotc.reporting._ -import scala.quoted.internal.impl.QuoteContextImpl +import scala.quoted.runtime.impl.QuoteContextImpl /** * Decompiler to be used with IDEs diff --git a/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala b/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala index 261fd0aa637d..a72ffa474e43 100644 --- a/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala @@ -74,6 +74,6 @@ class DecompilerPrinter(_ctx: Context) extends RefinedPrinter(_ctx) { } override protected def typeApplyText[T >: Untyped](tree: TypeApply[T]): Text = - if (tree.symbol eq defn.InternalQuoted_exprQuote) "'" + if (tree.symbol eq defn.QuotedRuntime_exprQuote) "'" else super.typeApplyText(tree) } diff --git a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala index 21948ada6b98..bcc40c5a57c0 100644 --- a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -389,7 +389,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { changePrec (GlobalPrec) { keywordStr("throw ") ~ toText(args.head) } - else if (!printDebug && fun.hasType && fun.symbol == defn.InternalQuoted_exprQuote) + else if (!printDebug && fun.hasType && fun.symbol == defn.QuotedRuntime_exprQuote) keywordStr("'{") ~ toTextGlobal(args, ", ") ~ keywordStr("}") else if (!printDebug && fun.hasType && fun.symbol.isExprSplice) keywordStr("${") ~ toTextGlobal(args, ", ") ~ keywordStr("}") diff --git a/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala b/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala index b87e98dcceac..ea6dd84f9f8f 100644 --- a/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala +++ b/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala @@ -20,7 +20,7 @@ import dotty.tools.dotc.report import scala.reflect.ClassTag import scala.quoted.QuoteContext -import scala.quoted.internal.impl._ +import scala.quoted.runtime.impl._ import scala.collection.mutable @@ -125,10 +125,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_SplicedTypeAnnot) => + case Block(stat :: rest, expr1) if stat.symbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot) => val typeSpliceMap = (stat :: rest).iterator.map { case tdef: TypeDef => - assert(tdef.symbol.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot)) + assert(tdef.symbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot)) val tree = tdef.rhs match case TypeBoundsTree(_, Hole(_, idx, args), _) => val quotedType = typeHole(idx, args) @@ -143,7 +143,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_SplicedTypeAnnot) => mapOver(t) + case Some(t) if tp.typeSymbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot) => mapOver(t) case _ => mapOver(tp) case _ => mapOver(tp) diff --git a/compiler/src/dotty/tools/dotc/transform/PCPCheckAndHeal.scala b/compiler/src/dotty/tools/dotc/transform/PCPCheckAndHeal.scala index ebab312e33eb..724971d869f8 100644 --- a/compiler/src/dotty/tools/dotc/transform/PCPCheckAndHeal.scala +++ b/compiler/src/dotty/tools/dotc/transform/PCPCheckAndHeal.scala @@ -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_SplicedTypeAnnot) => + case NoPrefix if level > levelOf(tp.symbol) && !tp.typeSymbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot) => val tp1 = tp.dealias if tp1 != tp then apply(tp1) else tryHeal(tp.symbol, tp, pos) @@ -279,7 +279,7 @@ object PCPCheckAndHeal { flags = Synthetic, info = TypeAlias(splicedTree.tpe.select(tpnme.Underlying)), coord = span).asType - local.addAnnotation(Annotation(defn.InternalQuoted_SplicedTypeAnnot)) + local.addAnnotation(Annotation(defn.QuotedRuntime_SplicedTypeAnnot)) ctx.typeAssigner.assignType(untpd.TypeDef(local.name, alias), local) } diff --git a/compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala b/compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala index 14e6af9693c8..d41b7dc2ab63 100644 --- a/compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala +++ b/compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala @@ -82,7 +82,7 @@ class PickleQuotes extends MacroTransform { assert(!tree.symbol.isQuote) assert(!tree.symbol.isExprSplice) case _ : TypeDef => - assert(!tree.symbol.hasAnnotation(defn.InternalQuoted_SplicedTypeAnnot), + assert(!tree.symbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot), s"${tree.symbol} should have been removed by PickledQuotes because it has a @quoteTypeTag") case _ => } @@ -481,7 +481,7 @@ class PickleQuotes extends MacroTransform { if (tree.isType) transformSpliceType(body, body.select(tpnme.Underlying)) else - val splice = ref(defn.InternalQuoted_exprSplice).appliedToType(tree.tpe).appliedTo(body) + val splice = ref(defn.QuotedRuntime_exprSplice).appliedToType(tree.tpe).appliedTo(body) transformSplice(body, splice) case tree: DefDef if tree.symbol.is(Macro) && level == 0 => diff --git a/compiler/src/dotty/tools/dotc/transform/Splicer.scala b/compiler/src/dotty/tools/dotc/transform/Splicer.scala index 2970f21ac594..3abbeed9d6bf 100644 --- a/compiler/src/dotty/tools/dotc/transform/Splicer.scala +++ b/compiler/src/dotty/tools/dotc/transform/Splicer.scala @@ -27,7 +27,7 @@ import scala.reflect.ClassTag import dotty.tools.dotc.quoted.{PickledQuotes, QuoteUtils} import scala.quoted.QuoteContext -import scala.quoted.internal.impl._ +import scala.quoted.runtime.impl._ /** Utility class to splice quoted expressions */ object Splicer { @@ -62,7 +62,7 @@ object Splicer { catch { case ex: CompilationUnit.SuspendException => throw ex - case ex: scala.quoted.internal.StopMacroExpansion if ctx.reporter.hasErrors => + case ex: scala.quoted.runtime.StopMacroExpansion if ctx.reporter.hasErrors => // errors have been emitted EmptyTree case ex: StopInterpretation => @@ -145,7 +145,7 @@ object Splicer { case Block(Nil, expr) => checkIfValidArgument(expr) case Typed(expr, _) => checkIfValidArgument(expr) - case Apply(Select(Apply(fn, quoted :: Nil), nme.apply), _) if fn.symbol == defn.InternalQuoted_exprQuote => + case Apply(Select(Apply(fn, quoted :: Nil), nme.apply), _) if fn.symbol == defn.QuotedRuntime_exprQuote => // OK case Apply(Select(TypeApply(fn, List(quoted)), nme.apply), _)if fn.symbol == defn.QuotedTypeModule_of => @@ -222,7 +222,7 @@ object Splicer { } def interpretTree(tree: Tree)(implicit env: Env): Object = tree match { - case Apply(Select(Apply(TypeApply(fn, _), quoted :: Nil), nme.apply), _) if fn.symbol == defn.InternalQuoted_exprQuote => + case Apply(Select(Apply(TypeApply(fn, _), quoted :: Nil), nme.apply), _) if fn.symbol == defn.QuotedRuntime_exprQuote => val quoted1 = quoted match { case quoted: Ident if quoted.symbol.isAllOf(InlineByNameProxy) => // inline proxy for by-name parameter @@ -419,7 +419,7 @@ object Splicer { throw new StopInterpretation(sw.toString, pos) case ex: InvocationTargetException => ex.getTargetException match { - case ex: scala.quoted.internal.StopMacroExpansion => + case ex: scala.quoted.runtime.StopMacroExpansion => throw ex case MissingClassDefinedInCurrentRun(sym) if ctx.compilationUnit.isSuspendable => if (ctx.settings.XprintSuspension.value) diff --git a/compiler/src/dotty/tools/dotc/transform/Staging.scala b/compiler/src/dotty/tools/dotc/transform/Staging.scala index 068d6f9e28ad..aa895fd01021 100644 --- a/compiler/src/dotty/tools/dotc/transform/Staging.scala +++ b/compiler/src/dotty/tools/dotc/transform/Staging.scala @@ -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_SplicedTypeAnnot) || + ctx.owner.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot) || (sym.isType && levelOf(sym) > 0), em"""access to $symStr from wrong staging level: | - the definition is at level ${levelOf(sym)}, diff --git a/compiler/src/dotty/tools/dotc/transform/SymUtils.scala b/compiler/src/dotty/tools/dotc/transform/SymUtils.scala index 4bf7fa0bebfd..97c379384d37 100644 --- a/compiler/src/dotty/tools/dotc/transform/SymUtils.scala +++ b/compiler/src/dotty/tools/dotc/transform/SymUtils.scala @@ -223,11 +223,11 @@ object SymUtils: /** Is symbol a quote operation? */ def isQuote(using Context): Boolean = - self == defn.InternalQuoted_exprQuote || self == defn.QuotedTypeModule_of + self == defn.QuotedRuntime_exprQuote || self == defn.QuotedTypeModule_of /** Is symbol a term splice operation? */ def isExprSplice(using Context): Boolean = - self == defn.InternalQuoted_exprSplice || self == defn.InternalQuoted_exprNestedSplice + self == defn.QuotedRuntime_exprSplice || self == defn.QuotedRuntime_exprNestedSplice /** Is symbol a type splice operation? */ def isTypeSplice(using Context): Boolean = diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index dd545d6d9df8..5c9a1d7ca05a 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -1264,7 +1264,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) { override def typedApply(tree: untpd.Apply, pt: Type)(using Context): Tree = constToLiteral(betaReduce(super.typedApply(tree, pt))) match { - case res: Apply if res.symbol == defn.InternalQuoted_exprSplice + case res: Apply if res.symbol == defn.QuotedRuntime_exprSplice && level == 0 && !suppressInline => val expanded = expandMacro(res.args.head, tree.span) diff --git a/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala b/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala index 2a2bebda7187..bf5c6fbba441 100644 --- a/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala +++ b/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala @@ -65,7 +65,7 @@ trait QuotesAndSplices { else report.warning(msg, tree.srcPos) typedTypeApply(untpd.TypeApply(untpd.ref(defn.QuotedTypeModule_of.termRef), tree.quoted :: Nil), pt)(using quoteContext).select(nme.apply).appliedTo(qctx) else - typedApply(untpd.Apply(untpd.ref(defn.InternalQuoted_exprQuote.termRef), tree.quoted), pt)(using pushQuoteContext(qctx)).select(nme.apply).appliedTo(qctx) + typedApply(untpd.Apply(untpd.ref(defn.QuotedRuntime_exprQuote.termRef), tree.quoted), pt)(using pushQuoteContext(qctx)).select(nme.apply).appliedTo(qctx) tree1.withSpan(tree.span) } @@ -86,7 +86,7 @@ trait QuotesAndSplices { using spliceContext.retractMode(Mode.QuotedPattern).addMode(Mode.Pattern).withOwner(spliceOwner(ctx))) val baseType = pat.tpe.baseType(defn.QuotedExprClass) val argType = if baseType != NoType then baseType.argTypesHi.head else defn.NothingType - ref(defn.InternalQuoted_exprSplice).appliedToType(argType).appliedTo(pat) + ref(defn.QuotedRuntime_exprSplice).appliedToType(argType).appliedTo(pat) } else { report.error(i"Type must be fully defined.\nConsider annotating the splice using a type ascription:\n ($tree: XYZ).", tree.expr.srcPos) @@ -107,8 +107,8 @@ trait QuotesAndSplices { val internalSplice = outerQctx match - case Some(qctxRef) => untpd.Apply(untpd.Apply(untpd.ref(defn.InternalQuoted_exprNestedSplice.termRef), qctxRef), tree.expr) - case _ => untpd.Apply(untpd.ref(defn.InternalQuoted_exprSplice.termRef), tree.expr) + case Some(qctxRef) => untpd.Apply(untpd.Apply(untpd.ref(defn.QuotedRuntime_exprNestedSplice.termRef), qctxRef), tree.expr) + case _ => untpd.Apply(untpd.ref(defn.QuotedRuntime_exprSplice.termRef), tree.expr) typedApply(internalSplice, pt)(using ctx1).withSpan(tree.span) } @@ -144,7 +144,7 @@ trait QuotesAndSplices { report.error("Missing arguments for open pattern", tree.srcPos) val argTypes = typedArgs.map(_.tpe.widenTermRefExpr) val typedPat = typedSplice(splice, defn.FunctionOf(argTypes, pt)) - ref(defn.InternalQuotedPatterns_patternHigherOrderHole).appliedToType(pt).appliedTo(typedPat, SeqLiteral(typedArgs, TypeTree(defn.AnyType))) + ref(defn.QuotedRuntimePatterns_patternHigherOrderHole).appliedToType(pt).appliedTo(typedPat, SeqLiteral(typedArgs, TypeTree(defn.AnyType))) } /** Translate ${ t: Type[T] }` into type `t.splice` while tracking the quotation level in the context */ @@ -184,7 +184,7 @@ trait QuotesAndSplices { case pt: TypeBounds => pt case _ => TypeBounds.empty val typeSym = newSymbol(spliceOwner(ctx), name, EmptyFlags, typeSymInfo, NoSymbol, tree.span) - typeSym.addAnnotation(Annotation(New(ref(defn.InternalQuotedPatterns_patternTypeAnnot.typeRef)).withSpan(tree.span))) + typeSym.addAnnotation(Annotation(New(ref(defn.QuotedRuntimePatterns_patternTypeAnnot.typeRef)).withSpan(tree.span))) val pat = typedPattern(expr, defn.QuotedTypeClass.typeRef.appliedTo(typeSym.typeRef))( using spliceContext.retractMode(Mode.QuotedPattern).withOwner(spliceOwner(ctx))) pat.select(tpnme.Underlying) @@ -249,14 +249,14 @@ trait QuotesAndSplices { case Typed(Apply(fn, pat :: Nil), tpt) if fn.symbol.isExprSplice && !tpt.tpe.derivesFrom(defn.RepeatedParamClass) => val tpt1 = transform(tpt) // Transform type bindings val exprTpt = AppliedTypeTree(TypeTree(defn.QuotedExprClass.typeRef), tpt1 :: Nil) - val newSplice = ref(defn.InternalQuoted_exprSplice).appliedToType(tpt1.tpe).appliedTo(Typed(pat, exprTpt)) + val newSplice = ref(defn.QuotedRuntime_exprSplice).appliedToType(tpt1.tpe).appliedTo(Typed(pat, exprTpt)) transform(newSplice) - case Apply(TypeApply(fn, targs), Apply(sp, pat :: Nil) :: args :: Nil) if fn.symbol == defn.InternalQuotedPatterns_patternHigherOrderHole => + case Apply(TypeApply(fn, targs), Apply(sp, pat :: Nil) :: args :: Nil) if fn.symbol == defn.QuotedRuntimePatterns_patternHigherOrderHole => args match // TODO support these patterns. Possibly using scala.quoted.util.Var case SeqLiteral(args, _) => for arg <- args; if arg.symbol.is(Mutable) do report.error("References to `var`s cannot be used in higher-order pattern", arg.srcPos) - try ref(defn.InternalQuotedPatterns_higherOrderHole.termRef).appliedToTypeTrees(targs).appliedTo(args).withSpan(tree.span) + try ref(defn.QuotedRuntimePatterns_higherOrderHole.termRef).appliedToTypeTrees(targs).appliedTo(args).withSpan(tree.span) finally { val patType = pat.tpe.widen val patType1 = patType.translateFromRepeated(toArray = false) @@ -264,7 +264,7 @@ trait QuotesAndSplices { patBuf += pat1 } case Apply(fn, pat :: Nil) if fn.symbol.isExprSplice => - try ref(defn.InternalQuotedPatterns_patternHole.termRef).appliedToType(tree.tpe).withSpan(tree.span) + try ref(defn.QuotedRuntimePatterns_patternHole.termRef).appliedToType(tree.tpe).withSpan(tree.span) finally { val patType = pat.tpe.widen val patType1 = patType.translateFromRepeated(toArray = false) @@ -281,7 +281,7 @@ trait QuotesAndSplices { else tree case tdef: TypeDef => - if tdef.symbol.hasAnnotation(defn.InternalQuotedPatterns_patternTypeAnnot) then + if tdef.symbol.hasAnnotation(defn.QuotedRuntimePatterns_patternTypeAnnot) then transformTypeBindingTypeDef(PatMatGivenVarName.fresh(tdef.name.toTermName), tdef, typePatBuf) else if tdef.symbol.isClass then val kind = if tdef.symbol.is(Module) then "objects" else "classes" @@ -320,7 +320,7 @@ trait QuotesAndSplices { private def transformTypeBindingTypeDef(nameOfSyntheticGiven: TermName, tdef: TypeDef, buff: mutable.Builder[Tree, List[Tree]])(using Context): Tree = { if (variance == -1) - tdef.symbol.addAnnotation(Annotation(New(ref(defn.InternalQuotedPatterns_fromAboveAnnot.typeRef)).withSpan(tdef.span))) + tdef.symbol.addAnnotation(Annotation(New(ref(defn.QuotedRuntimePatterns_fromAboveAnnot.typeRef)).withSpan(tdef.span))) val bindingType = getBinding(tdef.symbol).symbol.typeRef val bindingTypeTpe = AppliedType(defn.QuotedTypeClass.typeRef, bindingType :: Nil) val sym = newPatternBoundSymbol(nameOfSyntheticGiven, bindingTypeTpe, tdef.span, flags = ImplicitTerm)(using ctx0) @@ -460,7 +460,7 @@ trait QuotesAndSplices { val quoteClass = if (tree.quoted.isTerm) defn.QuotedExprClass else defn.QuotedTypeClass val quotedPattern = - if (tree.quoted.isTerm) ref(defn.InternalQuoted_exprQuote.termRef).appliedToType(defn.AnyType).appliedTo(shape).select(nme.apply).appliedTo(qctx) + if (tree.quoted.isTerm) ref(defn.QuotedRuntime_exprQuote.termRef).appliedToType(defn.AnyType).appliedTo(shape).select(nme.apply).appliedTo(qctx) else ref(defn.QuotedTypeModule_of.termRef).appliedToTypeTree(shape).select(nme.apply).appliedTo(qctx) val matchModule = if tree.quoted.isTerm then defn.QuoteMatching_ExprMatch else defn.QuoteMatching_TypeMatch diff --git a/compiler/src/scala/quoted/internal/impl/ExprImpl.scala b/compiler/src/scala/quoted/runtime/impl/ExprImpl.scala similarity index 98% rename from compiler/src/scala/quoted/internal/impl/ExprImpl.scala rename to compiler/src/scala/quoted/runtime/impl/ExprImpl.scala index fabd973c1df2..6965165dc3a2 100644 --- a/compiler/src/scala/quoted/internal/impl/ExprImpl.scala +++ b/compiler/src/scala/quoted/runtime/impl/ExprImpl.scala @@ -1,5 +1,5 @@ package scala.quoted -package internal.impl +package runtime.impl import dotty.tools.dotc.ast.tpd diff --git a/compiler/src/scala/quoted/internal/impl/Matcher.scala b/compiler/src/scala/quoted/runtime/impl/Matcher.scala similarity index 99% rename from compiler/src/scala/quoted/internal/impl/Matcher.scala rename to compiler/src/scala/quoted/runtime/impl/Matcher.scala index ba004a4794bf..d0428eef0623 100644 --- a/compiler/src/scala/quoted/internal/impl/Matcher.scala +++ b/compiler/src/scala/quoted/runtime/impl/Matcher.scala @@ -1,5 +1,5 @@ package scala.quoted -package internal.impl +package runtime.impl import scala.annotation.internal.sharable import scala.annotation.{Annotation, compileTimeOnly} diff --git a/compiler/src/scala/quoted/internal/impl/QuoteContextImpl.scala b/compiler/src/scala/quoted/runtime/impl/QuoteContextImpl.scala similarity index 99% rename from compiler/src/scala/quoted/internal/impl/QuoteContextImpl.scala rename to compiler/src/scala/quoted/runtime/impl/QuoteContextImpl.scala index c10282a4320b..03e3cbe35d6d 100644 --- a/compiler/src/scala/quoted/internal/impl/QuoteContextImpl.scala +++ b/compiler/src/scala/quoted/runtime/impl/QuoteContextImpl.scala @@ -1,5 +1,5 @@ package scala.quoted -package internal.impl +package runtime.impl import dotty.tools.dotc import dotty.tools.dotc.ast.tpd @@ -16,8 +16,8 @@ import dotty.tools.dotc.core.Decorators._ import dotty.tools.dotc.quoted.{MacroExpansion, PickledQuotes, QuoteUtils} -import scala.quoted.internal.{QuoteUnpickler, QuoteMatching} -import scala.quoted.internal.impl.printers._ +import scala.quoted.runtime.{QuoteUnpickler, QuoteMatching} +import scala.quoted.runtime.impl.printers._ import scala.reflect.TypeTest @@ -2626,7 +2626,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl def isTypeHoleDef(tree: Tree): Boolean = tree match case tree: TypeDef => - tree.symbol.hasAnnotation(dotc.core.Symbols.defn.InternalQuotedPatterns_patternTypeAnnot) + tree.symbol.hasAnnotation(dotc.core.Symbols.defn.QuotedRuntimePatterns_patternTypeAnnot) case _ => false def extractTypeHoles(pat: Term): (Term, List[Symbol]) = @@ -2651,8 +2651,8 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl val qctx1 = QuoteContextImpl()(using ctx1) val matcher = new Matcher.QuoteMatcher[qctx1.type](qctx1) { - def patternHoleSymbol: qctx1.reflect.Symbol = dotc.core.Symbols.defn.InternalQuotedPatterns_patternHole.asInstanceOf - def higherOrderHoleSymbol: qctx1.reflect.Symbol = dotc.core.Symbols.defn.InternalQuotedPatterns_higherOrderHole.asInstanceOf + def patternHoleSymbol: qctx1.reflect.Symbol = dotc.core.Symbols.defn.QuotedRuntimePatterns_patternHole.asInstanceOf + def higherOrderHoleSymbol: qctx1.reflect.Symbol = dotc.core.Symbols.defn.QuotedRuntimePatterns_higherOrderHole.asInstanceOf } val matchings = @@ -2665,7 +2665,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl // After matching and doing all subtype checks, we have to approximate all the type bindings // that we have found, seal them in a quoted.Type and add them to the result def typeHoleApproximation(sym: Symbol) = - ctx1.gadt.approximation(sym, !sym.hasAnnotation(dotc.core.Symbols.defn.InternalQuotedPatterns_fromAboveAnnot)).asInstanceOf[qctx1.reflect.TypeRepr].asType + ctx1.gadt.approximation(sym, !sym.hasAnnotation(dotc.core.Symbols.defn.QuotedRuntimePatterns_fromAboveAnnot)).asInstanceOf[qctx1.reflect.TypeRepr].asType matchings.map { tup => Tuple.fromIArray(typeHoles.map(typeHoleApproximation).toArray.asInstanceOf[IArray[Object]]) ++ tup } diff --git a/compiler/src/scala/quoted/internal/impl/ScopeException.scala b/compiler/src/scala/quoted/runtime/impl/ScopeException.scala similarity index 62% rename from compiler/src/scala/quoted/internal/impl/ScopeException.scala rename to compiler/src/scala/quoted/runtime/impl/ScopeException.scala index ec248d2c2999..73715ae111e5 100644 --- a/compiler/src/scala/quoted/internal/impl/ScopeException.scala +++ b/compiler/src/scala/quoted/runtime/impl/ScopeException.scala @@ -1,3 +1,3 @@ -package scala.quoted.internal.impl +package scala.quoted.runtime.impl class ScopeException(msg: String) extends Exception(msg) diff --git a/compiler/src/scala/quoted/internal/impl/TypeImpl.scala b/compiler/src/scala/quoted/runtime/impl/TypeImpl.scala similarity index 97% rename from compiler/src/scala/quoted/internal/impl/TypeImpl.scala rename to compiler/src/scala/quoted/runtime/impl/TypeImpl.scala index c90ccd8c1a08..398103b92666 100644 --- a/compiler/src/scala/quoted/internal/impl/TypeImpl.scala +++ b/compiler/src/scala/quoted/runtime/impl/TypeImpl.scala @@ -1,5 +1,5 @@ package scala.quoted -package internal.impl +package runtime.impl import dotty.tools.dotc.ast.tpd diff --git a/compiler/src/scala/quoted/internal/impl/printers/Extractors.scala b/compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala similarity index 99% rename from compiler/src/scala/quoted/internal/impl/printers/Extractors.scala rename to compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala index 410135978144..aa215ea0188f 100644 --- a/compiler/src/scala/quoted/internal/impl/printers/Extractors.scala +++ b/compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala @@ -1,5 +1,5 @@ package scala.quoted -package internal.impl.printers +package runtime.impl.printers import scala.quoted._ diff --git a/compiler/src/scala/quoted/internal/impl/printers/SourceCode.scala b/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala similarity index 99% rename from compiler/src/scala/quoted/internal/impl/printers/SourceCode.scala rename to compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala index 5bca66c1188d..59689d6f4ba9 100644 --- a/compiler/src/scala/quoted/internal/impl/printers/SourceCode.scala +++ b/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala @@ -1,5 +1,5 @@ package scala.quoted -package internal.impl.printers +package runtime.impl.printers import scala.annotation.switch diff --git a/compiler/src/scala/quoted/internal/impl/printers/SyntaxHighlight.scala b/compiler/src/scala/quoted/runtime/impl/printers/SyntaxHighlight.scala similarity index 98% rename from compiler/src/scala/quoted/internal/impl/printers/SyntaxHighlight.scala rename to compiler/src/scala/quoted/runtime/impl/printers/SyntaxHighlight.scala index 3b4641f4e6c9..cc3ecc2b153a 100644 --- a/compiler/src/scala/quoted/internal/impl/printers/SyntaxHighlight.scala +++ b/compiler/src/scala/quoted/runtime/impl/printers/SyntaxHighlight.scala @@ -1,5 +1,5 @@ package scala.quoted -package internal.impl.printers +package runtime.impl.printers trait SyntaxHighlight { def highlightKeyword(str: String): String diff --git a/library/src/scala/quoted/internal/Expr.scala b/library/src-non-bootstrapped/scala/quoted/internal/Expr.scala similarity index 100% rename from library/src/scala/quoted/internal/Expr.scala rename to library/src-non-bootstrapped/scala/quoted/internal/Expr.scala diff --git a/library/src/scala/quoted/internal/Patterns.scala b/library/src-non-bootstrapped/scala/quoted/internal/Patterns.scala similarity index 100% rename from library/src/scala/quoted/internal/Patterns.scala rename to library/src-non-bootstrapped/scala/quoted/internal/Patterns.scala diff --git a/library/src/scala/quoted/internal/SplicedType.scala b/library/src-non-bootstrapped/scala/quoted/internal/SplicedType.scala similarity index 100% rename from library/src/scala/quoted/internal/SplicedType.scala rename to library/src-non-bootstrapped/scala/quoted/internal/SplicedType.scala diff --git a/library/src/scala/quoted/QuoteContext.scala b/library/src/scala/quoted/QuoteContext.scala index 47cee6668046..685e3d4c3988 100644 --- a/library/src/scala/quoted/QuoteContext.scala +++ b/library/src/scala/quoted/QuoteContext.scala @@ -10,7 +10,7 @@ import scala.reflect.TypeTest * * @param tasty Typed AST API. Usage: `def f(qctx: QuoteContext) = { import qctx.reflect._; ... }`. */ -trait QuoteContext { self: internal.QuoteUnpickler & internal.QuoteMatching => +trait QuoteContext { self: runtime.QuoteUnpickler & runtime.QuoteMatching => // Extension methods for `Expr[T]` extension [T](self: Expr[T]): diff --git a/library/src/scala/quoted/report.scala b/library/src/scala/quoted/report.scala index 1fcb45fa8992..2c42a2bc4124 100644 --- a/library/src/scala/quoted/report.scala +++ b/library/src/scala/quoted/report.scala @@ -15,12 +15,12 @@ object report: /** Report an error at the position of the macro expansion and throws a StopMacroExpansion */ def throwError(msg: => String)(using qctx: QuoteContext): Nothing = { error(msg) - throw new internal.StopMacroExpansion + throw new runtime.StopMacroExpansion } /** Report an error at the on the position of `expr` and throws a StopMacroExpansion */ def throwError(msg: => String, expr: Expr[Any])(using qctx: QuoteContext): Nothing = { error(msg, expr) - throw new internal.StopMacroExpansion + throw new runtime.StopMacroExpansion } /** Report a warning */ diff --git a/library/src/scala/quoted/runtime/Expr.scala b/library/src/scala/quoted/runtime/Expr.scala new file mode 100644 index 000000000000..46301efa2268 --- /dev/null +++ b/library/src/scala/quoted/runtime/Expr.scala @@ -0,0 +1,21 @@ +package scala.quoted +package runtime + +import scala.annotation.{Annotation, compileTimeOnly} + +@compileTimeOnly("Illegal reference to `scala.quoted.runtime.Expr`") +object Expr: + + /** A term quote is desugared by the compiler into a call to this method */ + @compileTimeOnly("Illegal reference to `scala.quoted.runtime.Expr.quote`") + def quote[T](x: T): QuoteContext ?=> scala.quoted.Expr[T] = ??? + + /** A term splice is desugared by the compiler into a call to this method */ + @compileTimeOnly("Illegal reference to `scala.quoted.runtime.Expr.splice`") + def splice[T](x: QuoteContext ?=> scala.quoted.Expr[T]): T = ??? + + /** A term splice nested within a quote is desugared by the compiler into a call to this method. + * `ctx` is the `QuoteContext` that the quote of this splice uses. + */ + @compileTimeOnly("Illegal reference to `scala.quoted.runtime.Expr.nestedSplice`") + def nestedSplice[T](ctx: QuoteContext)(x: ctx.Nested ?=> scala.quoted.Expr[T]): T = ??? diff --git a/library/src/scala/quoted/runtime/Patterns.scala b/library/src/scala/quoted/runtime/Patterns.scala new file mode 100644 index 000000000000..cca57f43417e --- /dev/null +++ b/library/src/scala/quoted/runtime/Patterns.scala @@ -0,0 +1,28 @@ +package scala.quoted.runtime + +import scala.annotation.{Annotation, compileTimeOnly} + +@compileTimeOnly("Illegal reference to `scala.quoted.runtime.Patterns`") +object Patterns { + + /** A splice in a quoted pattern is desugared by the compiler into a call to this method */ + @compileTimeOnly("Illegal reference to `scala.quoted.runtime.Patterns.patternHole`") + def patternHole[T]: T = ??? + + @compileTimeOnly("Illegal reference to `scala.quoted.runtime.Patterns.patternHigherOrderHole`") + /** A higher order splice in a quoted pattern is desugared by the compiler into a call to this method */ + def patternHigherOrderHole[U](pat: Any, args: Any*): U = ??? + + @compileTimeOnly("Illegal reference to `scala.quoted.runtime.Patterns.higherOrderHole`") + /** A higher order splice in a quoted pattern is desugared by the compiler into a call to this method */ + def higherOrderHole[U](args: Any*): U = ??? + + /** A splice of a name in a quoted pattern is that marks the definition of a type splice */ + @compileTimeOnly("Illegal reference to `scala.quoted.runtime.Patterns.patternType`") + class patternType extends Annotation + + /** A type pattern that must be aproximated from above */ + @compileTimeOnly("Illegal reference to `scala.quoted.runtime.Patterns.fromAbove`") + class fromAbove extends Annotation + +} diff --git a/library/src/scala/quoted/internal/QuoteMatching.scala b/library/src/scala/quoted/runtime/QuoteMatching.scala similarity index 92% rename from library/src/scala/quoted/internal/QuoteMatching.scala rename to library/src/scala/quoted/runtime/QuoteMatching.scala index 0acf4ead9f1d..27e0b1656de8 100644 --- a/library/src/scala/quoted/internal/QuoteMatching.scala +++ b/library/src/scala/quoted/runtime/QuoteMatching.scala @@ -1,9 +1,9 @@ -package scala.quoted.internal +package scala.quoted.runtime import scala.quoted.{QuoteContext, Expr, Type} /** Part of the QuoteContext interface that needs to be implemented by the compiler but is not visible to users */ -trait QuoteMatching { +trait QuoteMatching: val ExprMatch: ExprMatchModule @@ -20,7 +20,7 @@ trait QuoteMatching { * will return `None` due to the missmatch of types in the hole * * Holes: - * - scala.quoted.internal.Patterns.patternHole[T]: hole that matches an expression `x` of type `Expr[U]` + * - scala.quoted.runtime.Patterns.patternHole[T]: hole that matches an expression `x` of type `Expr[U]` * if `U <:< T` and returns `x` as part of the match. * * @param scrutinee `Expr[Any]` on which we are pattern matching @@ -46,4 +46,3 @@ trait QuoteMatching { */ def unapply[TypeBindings <: Tuple, Tup <: Tuple](scrutinee: Type[?])(using pattern: Type[?]): Option[Tup] } -} diff --git a/library/src/scala/quoted/internal/QuoteUnpickler.scala b/library/src/scala/quoted/runtime/QuoteUnpickler.scala similarity index 92% rename from library/src/scala/quoted/internal/QuoteUnpickler.scala rename to library/src/scala/quoted/runtime/QuoteUnpickler.scala index 7b79f0f7039d..07f57a843fcd 100644 --- a/library/src/scala/quoted/internal/QuoteUnpickler.scala +++ b/library/src/scala/quoted/runtime/QuoteUnpickler.scala @@ -1,9 +1,9 @@ -package scala.quoted.internal +package scala.quoted.runtime import scala.quoted.{QuoteContext, Expr, Type} /** Part of the QuoteContext interface that needs to be implemented by the compiler but is not visible to users */ -trait QuoteUnpickler { +trait QuoteUnpickler: /** Unpickle `repr` which represents a pickled `Expr` tree, * replacing splice nodes with `holes` @@ -15,4 +15,3 @@ trait QuoteUnpickler { */ def unpickleType[T <: AnyKind](pickled: String | List[String], typeHole: (Int, Seq[Any]) => Type[?], termHole: (Int, Seq[Any], QuoteContext) => Expr[?]): scala.quoted.Type[T] -} diff --git a/library/src/scala/quoted/runtime/SplicedType.scala b/library/src/scala/quoted/runtime/SplicedType.scala new file mode 100644 index 000000000000..1b07eafb5809 --- /dev/null +++ b/library/src/scala/quoted/runtime/SplicedType.scala @@ -0,0 +1,14 @@ +package scala.quoted.runtime + +import scala.annotation.{Annotation, compileTimeOnly} + +/** Artifact of pickled type splices + * + * During quote reification a quote `'{ ... F[t.Underlying] ... }` will be transformed into + * `'{ @SplicedType type T$1 = t.Underlying ... F[T$1] ... }` to have a tree for `t.Underlying`. + * This artifact is removed during quote unpickling. + * + * See PickleQuotes.scala and PickledQuotes.scala + */ +@compileTimeOnly("Illegal reference to `scala.quoted.runtime.SplicedType`") +class SplicedType extends Annotation diff --git a/library/src/scala/quoted/internal/StopMacroExpansion.scala b/library/src/scala/quoted/runtime/StopMacroExpansion.scala similarity index 80% rename from library/src/scala/quoted/internal/StopMacroExpansion.scala rename to library/src/scala/quoted/runtime/StopMacroExpansion.scala index 198651841c9e..ebf9ad7e57b6 100644 --- a/library/src/scala/quoted/internal/StopMacroExpansion.scala +++ b/library/src/scala/quoted/runtime/StopMacroExpansion.scala @@ -1,4 +1,4 @@ -package scala.quoted.internal +package scala.quoted.runtime /** Throwable used to stop the expansion of a macro after an error was reported */ class StopMacroExpansion extends Throwable diff --git a/scala3doc/src/dotty/dokka/tasty/TastyParser.scala b/scala3doc/src/dotty/dokka/tasty/TastyParser.scala index 656adda4218a..3f9b61acc7b9 100644 --- a/scala3doc/src/dotty/dokka/tasty/TastyParser.scala +++ b/scala3doc/src/dotty/dokka/tasty/TastyParser.scala @@ -43,7 +43,7 @@ case class SbtDokkaTastyInspector( import dotty.tools.dotc.core.Mode import dotty.tools.dotc.core.Phases.Phase import dotty.tools.dotc.fromtasty._ - import scala.quoted.internal.impl.QuoteContextImpl + import scala.quoted.runtime.impl.QuoteContextImpl val parser: Parser = null diff --git a/staging/src/scala/quoted/staging/QuoteCompiler.scala b/staging/src/scala/quoted/staging/QuoteCompiler.scala index 023f26976b15..6c8c40ace3aa 100644 --- a/staging/src/scala/quoted/staging/QuoteCompiler.scala +++ b/staging/src/scala/quoted/staging/QuoteCompiler.scala @@ -21,7 +21,7 @@ import dotty.tools.dotc.util.Spans.Span import dotty.tools.dotc.util.SourceFile import dotty.tools.io.{Path, VirtualFile} -import scala.quoted.internal.impl.QuoteContextImpl +import scala.quoted.runtime.impl.QuoteContextImpl import scala.annotation.tailrec import scala.concurrent.Promise diff --git a/staging/src/scala/quoted/staging/Toolbox.scala b/staging/src/scala/quoted/staging/Toolbox.scala index f9e939ae58f4..3763bd9c49bb 100644 --- a/staging/src/scala/quoted/staging/Toolbox.scala +++ b/staging/src/scala/quoted/staging/Toolbox.scala @@ -3,7 +3,7 @@ package staging import scala.annotation.implicitNotFound -import scala.quoted.internal.impl.ScopeException +import scala.quoted.runtime.impl.ScopeException @implicitNotFound("Could not find implicit scala.quoted.staging.Toolbox.\n\nDefault toolbox can be instantiated with:\n `given scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader)`\n\n") trait Toolbox: diff --git a/tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala b/tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala index b7aa7726b89f..2d1396eafada 100644 --- a/tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala +++ b/tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala @@ -1,7 +1,7 @@ package scala.tasty.inspector import scala.quoted._ -import scala.quoted.internal.impl.QuoteContextImpl +import scala.quoted.runtime.impl.QuoteContextImpl import dotty.tools.dotc.Compiler import dotty.tools.dotc.Driver diff --git a/tests/run-macros/quote-matcher-runtime.check b/tests/run-macros/quote-matcher-runtime.check index 7a34f53bb661..9d184cb7cacd 100644 --- a/tests/run-macros/quote-matcher-runtime.check +++ b/tests/run-macros/quote-matcher-runtime.check @@ -19,55 +19,55 @@ Pattern: (1: scala.Int) Result: Some(List()) Scrutinee: 3 -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Int] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] Result: Some(List(Expr(3))) Scrutinee: x -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Int] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] Result: Some(List(Expr(x))) Scrutinee: 5 -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Any] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Any] Result: Some(List(Expr(5))) Scrutinee: 6.+(x) -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Int] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] Result: Some(List(Expr(6.+(x)))) Scrutinee: 6.+(x) -Pattern: 6.+(scala.quoted.internal.Patterns.patternHole[scala.Int]) +Pattern: 6.+(scala.quoted.runtime.Patterns.patternHole[scala.Int]) Result: Some(List(Expr(x))) Scrutinee: 6.+(x) -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Int].+(x) +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int].+(x) Result: Some(List(Expr(6))) Scrutinee: 6.+(x) -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Int].+(scala.quoted.internal.Patterns.patternHole[scala.Int]) +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int].+(scala.quoted.runtime.Patterns.patternHole[scala.Int]) Result: Some(List(Expr(6), Expr(x))) Scrutinee: 6.+(x).+(y) -Pattern: 6.+(scala.quoted.internal.Patterns.patternHole[scala.Int]).+(y) +Pattern: 6.+(scala.quoted.runtime.Patterns.patternHole[scala.Int]).+(y) Result: Some(List(Expr(x))) Scrutinee: 4 -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Predef.String] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Predef.String] Result: None Scrutinee: 6.+(x) -Pattern: 7.+(scala.quoted.internal.Patterns.patternHole[scala.Int]) +Pattern: 7.+(scala.quoted.runtime.Patterns.patternHole[scala.Int]) Result: None Scrutinee: 6.+(x) -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Int].+(4) +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int].+(4) Result: None Scrutinee: g[scala.Int] -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Predef.String] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Predef.String] Result: None Scrutinee: h[scala.Int](7) -Pattern: h[scala.Predef.String](scala.quoted.internal.Patterns.patternHole[scala.Predef.String]) +Pattern: h[scala.Predef.String](scala.quoted.runtime.Patterns.patternHole[scala.Predef.String]) Result: None Scrutinee: h[scala.Int](6) @@ -83,23 +83,23 @@ Pattern: z2 = 4 Result: None Scrutinee: f(4) -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Int] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] Result: Some(List(Expr(f(4)))) Scrutinee: f(5) -Pattern: f(scala.quoted.internal.Patterns.patternHole[scala.Int]) +Pattern: f(scala.quoted.runtime.Patterns.patternHole[scala.Int]) Result: Some(List(Expr(5))) Scrutinee: g[scala.Int] -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Int] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] Result: Some(List(Expr(g[scala.Int]))) Scrutinee: h[scala.Int](7) -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Int] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] Result: Some(List(Expr(h[scala.Int](7)))) Scrutinee: h[scala.Int](8) -Pattern: h[scala.Int](scala.quoted.internal.Patterns.patternHole[scala.Int]) +Pattern: h[scala.Int](scala.quoted.runtime.Patterns.patternHole[scala.Int]) Result: Some(List(Expr(8))) Scrutinee: Test.this @@ -107,7 +107,7 @@ Pattern: Test.this Result: Some(List()) Scrutinee: Test.this -Pattern: scala.quoted.internal.Patterns.patternHole[this.type] +Pattern: scala.quoted.runtime.Patterns.patternHole[this.type] Result: Some(List(Expr(Test.this))) Scrutinee: new Foo(1) @@ -115,11 +115,11 @@ Pattern: new Foo(1) Result: Some(List()) Scrutinee: new Foo(1) -Pattern: scala.quoted.internal.Patterns.patternHole[Foo] +Pattern: scala.quoted.runtime.Patterns.patternHole[Foo] Result: Some(List(Expr(new Foo(1)))) Scrutinee: new Foo(1) -Pattern: new Foo(scala.quoted.internal.Patterns.patternHole[scala.Int]) +Pattern: new Foo(scala.quoted.runtime.Patterns.patternHole[scala.Int]) Result: Some(List(Expr(1))) Scrutinee: if (b) x else y @@ -127,11 +127,11 @@ Pattern: if (b) x else y Result: Some(List()) Scrutinee: if (b) x else y -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Int] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] Result: Some(List(Expr(if (b) x else y))) Scrutinee: if (b) x else y -Pattern: if (scala.quoted.internal.Patterns.patternHole[scala.Boolean]) scala.quoted.internal.Patterns.patternHole[scala.Int] else scala.quoted.internal.Patterns.patternHole[scala.Int] +Pattern: if (scala.quoted.runtime.Patterns.patternHole[scala.Boolean]) scala.quoted.runtime.Patterns.patternHole[scala.Int] else scala.quoted.runtime.Patterns.patternHole[scala.Int] Result: Some(List(Expr(b), Expr(x), Expr(y))) Scrutinee: while (b) { @@ -148,7 +148,7 @@ Scrutinee: while (b) { x () } -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Unit] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Unit] Result: Some(List(Expr(while (b) { x () @@ -158,8 +158,8 @@ Scrutinee: while (b) { x () } -Pattern: while (scala.quoted.internal.Patterns.patternHole[scala.Boolean]) { - scala.quoted.internal.Patterns.patternHole[scala.Int] +Pattern: while (scala.quoted.runtime.Patterns.patternHole[scala.Boolean]) { + scala.quoted.runtime.Patterns.patternHole[scala.Int] () } Result: Some(List(Expr(b), Expr(x))) @@ -169,11 +169,11 @@ Pattern: z = 4 Result: Some(List()) Scrutinee: z = 4 -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Unit] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Unit] Result: Some(List(Expr(z = 4))) Scrutinee: z = 4 -Pattern: z = scala.quoted.internal.Patterns.patternHole[scala.Int] +Pattern: z = scala.quoted.runtime.Patterns.patternHole[scala.Int] Result: Some(List(Expr(4))) Scrutinee: 1 @@ -189,7 +189,7 @@ Pattern: fs() Result: Some(List()) Scrutinee: fs() -Pattern: fs(scala.quoted.internal.Patterns.patternHole[scala.Seq[scala.Int]]: _*) +Pattern: fs(scala.quoted.runtime.Patterns.patternHole[scala.Seq[scala.Int]]: _*) Result: Some(List(Expr())) Scrutinee: fs(1, 2, 3) @@ -197,11 +197,11 @@ Pattern: fs(1, 2, 3) Result: Some(List()) Scrutinee: fs(1, 2, 3) -Pattern: fs(scala.quoted.internal.Patterns.patternHole[scala.Int], scala.quoted.internal.Patterns.patternHole[scala.Int], 3) +Pattern: fs(scala.quoted.runtime.Patterns.patternHole[scala.Int], scala.quoted.runtime.Patterns.patternHole[scala.Int], 3) Result: Some(List(Expr(1), Expr(2))) Scrutinee: fs(1, 2, 3) -Pattern: fs(scala.quoted.internal.Patterns.patternHole[scala.Seq[scala.Int]]: _*) +Pattern: fs(scala.quoted.runtime.Patterns.patternHole[scala.Seq[scala.Int]]: _*) Result: Some(List(Expr(1, 2, 3))) Scrutinee: f2(1, 2) @@ -213,7 +213,7 @@ Pattern: f2(a = 1, b = 2) Result: Some(List()) Scrutinee: f2(a = 1, b = 2) -Pattern: f2(a = scala.quoted.internal.Patterns.patternHole[scala.Int], b = scala.quoted.internal.Patterns.patternHole[scala.Int]) +Pattern: f2(a = scala.quoted.runtime.Patterns.patternHole[scala.Int], b = scala.quoted.runtime.Patterns.patternHole[scala.Int]) Result: Some(List(Expr(1), Expr(2))) Scrutinee: super.toString() @@ -221,23 +221,23 @@ Pattern: super.toString() Result: Some(List()) Scrutinee: (() => "abc") -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Function0[scala.Predef.String]] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Function0[scala.Predef.String]] Result: Some(List(Expr((() => "abc")))) Scrutinee: (() => "abc").apply() -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Function0[scala.Predef.String]].apply() +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Function0[scala.Predef.String]].apply() Result: Some(List(Expr((() => "abc")))) Scrutinee: ((x: scala.Int) => "abc") -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Function1[scala.Int, scala.Predef.String]] +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Function1[scala.Int, scala.Predef.String]] Result: Some(List(Expr(((x: scala.Int) => "abc")))) Scrutinee: ((x: scala.Int) => "abc").apply(4) -Pattern: scala.quoted.internal.Patterns.patternHole[scala.Function1[scala.Int, scala.Predef.String]].apply(4) +Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Function1[scala.Int, scala.Predef.String]].apply(4) Result: Some(List(Expr(((x: scala.Int) => "abc")))) Scrutinee: ((x: scala.Int) => "abc") -Pattern: ((x: scala.Int) => scala.quoted.internal.Patterns.patternHole[scala.Predef.String]) +Pattern: ((x: scala.Int) => scala.quoted.runtime.Patterns.patternHole[scala.Predef.String]) Result: Some(List(Expr("abc"))) Scrutinee: scala.StringContext.apply("abc", "xyz") @@ -245,11 +245,11 @@ Pattern: scala.StringContext.apply("abc", "xyz") Result: Some(List()) Scrutinee: scala.StringContext.apply("abc", "xyz") -Pattern: scala.StringContext.apply(scala.quoted.internal.Patterns.patternHole[java.lang.String], scala.quoted.internal.Patterns.patternHole[java.lang.String]) +Pattern: scala.StringContext.apply(scala.quoted.runtime.Patterns.patternHole[java.lang.String], scala.quoted.runtime.Patterns.patternHole[java.lang.String]) Result: Some(List(Expr("abc"), Expr("xyz"))) Scrutinee: scala.StringContext.apply("abc", "xyz") -Pattern: scala.StringContext.apply(scala.quoted.internal.Patterns.patternHole[scala.Seq[scala.Predef.String]]: _*) +Pattern: scala.StringContext.apply(scala.quoted.runtime.Patterns.patternHole[scala.Seq[scala.Predef.String]]: _*) Result: Some(List(Expr("abc", "xyz"))) Scrutinee: { @@ -267,7 +267,7 @@ Scrutinee: { () } Pattern: { - val a: scala.Int = scala.quoted.internal.Patterns.patternHole[scala.Int] + val a: scala.Int = scala.quoted.runtime.Patterns.patternHole[scala.Int] () } Result: Some(List(Expr(45))) @@ -297,7 +297,7 @@ Scrutinee: { () } Pattern: { - var a: scala.Int = scala.quoted.internal.Patterns.patternHole[scala.Int] + var a: scala.Int = scala.quoted.runtime.Patterns.patternHole[scala.Int] () } Result: None @@ -330,7 +330,7 @@ Scrutinee: { } Pattern: { val x: scala.Int = 45 - x.+(scala.quoted.internal.Patterns.patternHole[scala.Int]) + x.+(scala.quoted.runtime.Patterns.patternHole[scala.Int]) } Result: None @@ -369,7 +369,7 @@ Scrutinee: { () } Pattern: { - val a: scala.Int = scala.quoted.internal.Patterns.patternHole[scala.Int] + val a: scala.Int = scala.quoted.runtime.Patterns.patternHole[scala.Int] () } Result: None @@ -379,7 +379,7 @@ Scrutinee: { () } Pattern: { - var a: scala.Int = scala.quoted.internal.Patterns.patternHole[scala.Int] + var a: scala.Int = scala.quoted.runtime.Patterns.patternHole[scala.Int] () } Result: None @@ -419,7 +419,7 @@ Scrutinee: { () } Pattern: { - val a: scala.Int = scala.quoted.internal.Patterns.patternHole[scala.Int] + val a: scala.Int = scala.quoted.runtime.Patterns.patternHole[scala.Int] () } Result: None @@ -429,7 +429,7 @@ Scrutinee: { () } Pattern: { - lazy val a: scala.Int = scala.quoted.internal.Patterns.patternHole[scala.Int] + lazy val a: scala.Int = scala.quoted.runtime.Patterns.patternHole[scala.Int] () } Result: None @@ -499,7 +499,7 @@ Scrutinee: { () } Pattern: { - def a: scala.Int = scala.quoted.internal.Patterns.patternHole[scala.Int] + def a: scala.Int = scala.quoted.runtime.Patterns.patternHole[scala.Int] () } Result: Some(List(Expr(45))) @@ -619,8 +619,8 @@ Scrutinee: { a.+(a) } Pattern: { - def a: scala.Int = scala.quoted.internal.Patterns.patternHole[scala.Int] - a.+(scala.quoted.internal.Patterns.patternHole[scala.Int]) + def a: scala.Int = scala.quoted.runtime.Patterns.patternHole[scala.Int] + a.+(scala.quoted.runtime.Patterns.patternHole[scala.Int]) } Result: None @@ -636,22 +636,22 @@ Result: Some(List()) Scrutinee: scala.List.apply[scala.Int](1, 2, 3).foreach[scala.Unit](((x: scala.Int) => scala.Predef.println(x))) Pattern: { - @scala.quoted.internal.Patterns.patternType type T - scala.quoted.internal.Patterns.patternHole[scala.List[scala.Int]].foreach[T](scala.quoted.internal.Patterns.patternHole[scala.Function1[scala.Int, T]]) + @scala.quoted.runtime.Patterns.patternType type T + scala.quoted.runtime.Patterns.patternHole[scala.List[scala.Int]].foreach[T](scala.quoted.runtime.Patterns.patternHole[scala.Function1[scala.Int, T]]) } Result: Some(List(Type(scala.Unit), Expr(scala.List.apply[scala.Int](1, 2, 3)), Expr(((x: scala.Int) => scala.Predef.println(x))))) Scrutinee: scala.List.apply[scala.Int](1, 2, 3).foreach[scala.Unit](((x: scala.Int) => scala.Predef.println(x))) Pattern: { - @scala.quoted.internal.Patterns.patternType type T = scala.Unit - scala.quoted.internal.Patterns.patternHole[scala.List[scala.Int]].foreach[T](scala.quoted.internal.Patterns.patternHole[scala.Function1[scala.Int, T]]) + @scala.quoted.runtime.Patterns.patternType type T = scala.Unit + scala.quoted.runtime.Patterns.patternHole[scala.List[scala.Int]].foreach[T](scala.quoted.runtime.Patterns.patternHole[scala.Function1[scala.Int, T]]) } Result: Some(List(Type(scala.Unit), Expr(scala.List.apply[scala.Int](1, 2, 3)), Expr(((x: scala.Int) => scala.Predef.println(x))))) Scrutinee: scala.List.apply[scala.Int](1, 2, 3).foreach[scala.Unit](((x: scala.Int) => scala.Predef.println(x))) Pattern: { - @scala.quoted.internal.Patterns.patternType type T <: scala.Predef.String - scala.quoted.internal.Patterns.patternHole[scala.List[scala.Int]].foreach[T](scala.quoted.internal.Patterns.patternHole[scala.Function1[scala.Int, T]]) + @scala.quoted.runtime.Patterns.patternType type T <: scala.Predef.String + scala.quoted.runtime.Patterns.patternHole[scala.List[scala.Int]].foreach[T](scala.quoted.runtime.Patterns.patternHole[scala.Function1[scala.Int, T]]) } Result: None @@ -661,9 +661,9 @@ Scrutinee: { () } Pattern: { - @scala.quoted.internal.Patterns.patternType type T - val a: T = scala.quoted.internal.Patterns.patternHole[T] - val b: T = scala.quoted.internal.Patterns.patternHole[T] + @scala.quoted.runtime.Patterns.patternType type T + val a: T = scala.quoted.runtime.Patterns.patternHole[T] + val b: T = scala.quoted.runtime.Patterns.patternHole[T] () } Result: Some(List(Type(scala.Int), Expr(4), Expr(4))) @@ -674,9 +674,9 @@ Scrutinee: { () } Pattern: { - @scala.quoted.internal.Patterns.patternType type T - val a: T = scala.quoted.internal.Patterns.patternHole[T] - val b: T = scala.quoted.internal.Patterns.patternHole[T] + @scala.quoted.runtime.Patterns.patternType type T + val a: T = scala.quoted.runtime.Patterns.patternHole[T] + val b: T = scala.quoted.runtime.Patterns.patternHole[T] () } Result: Some(List(Type(scala.Int), Expr(4), Expr(5))) @@ -687,9 +687,9 @@ Scrutinee: { () } Pattern: { - @scala.quoted.internal.Patterns.patternType type T - val a: T = scala.quoted.internal.Patterns.patternHole[T] - val b: T = scala.quoted.internal.Patterns.patternHole[T] + @scala.quoted.runtime.Patterns.patternType type T + val a: T = scala.quoted.runtime.Patterns.patternHole[T] + val b: T = scala.quoted.runtime.Patterns.patternHole[T] () } Result: Some(List(Type(scala.Int | java.lang.String), Expr(4), Expr("x"))) @@ -700,52 +700,52 @@ Scrutinee: { () } Pattern: { - @scala.quoted.internal.Patterns.patternType type T <: scala.Int - val a: T = scala.quoted.internal.Patterns.patternHole[T] - val b: T = scala.quoted.internal.Patterns.patternHole[T] + @scala.quoted.runtime.Patterns.patternType type T <: scala.Int + val a: T = scala.quoted.runtime.Patterns.patternHole[T] + val b: T = scala.quoted.runtime.Patterns.patternHole[T] () } Result: None Scrutinee: scala.List.apply[scala.Int](1, 2, 3).map[scala.Double](((x: scala.Int) => x.toDouble./(2))).map[java.lang.String](((y: scala.Double) => y.toString())) Pattern: { - @scala.quoted.internal.Patterns.patternType type T - @scala.quoted.internal.Patterns.patternType type U - @scala.quoted.internal.Patterns.patternType type V + @scala.quoted.runtime.Patterns.patternType type T + @scala.quoted.runtime.Patterns.patternType type U + @scala.quoted.runtime.Patterns.patternType type V - (scala.quoted.internal.Patterns.patternHole[scala.List[T]].map[U](scala.quoted.internal.Patterns.patternHole[scala.Function1[T, U]]).map[V](scala.quoted.internal.Patterns.patternHole[scala.Function1[U, V]]): scala.collection.immutable.List[scala.Any]) + (scala.quoted.runtime.Patterns.patternHole[scala.List[T]].map[U](scala.quoted.runtime.Patterns.patternHole[scala.Function1[T, U]]).map[V](scala.quoted.runtime.Patterns.patternHole[scala.Function1[U, V]]): scala.collection.immutable.List[scala.Any]) } Result: Some(List(Type(scala.Int), Type(scala.Double), Type(java.lang.String), Expr(scala.List.apply[scala.Int](1, 2, 3)), Expr(((x: scala.Int) => x.toDouble./(2))), Expr(((y: scala.Double) => y.toString())))) Scrutinee: ((x: scala.Int) => x) Pattern: { - @scala.quoted.internal.Patterns.patternType type T + @scala.quoted.runtime.Patterns.patternType type T - (scala.quoted.internal.Patterns.patternHole[scala.Function1[T, T]]: scala.Function1[scala.Nothing, scala.Any]) + (scala.quoted.runtime.Patterns.patternHole[scala.Function1[T, T]]: scala.Function1[scala.Nothing, scala.Any]) } Result: Some(List(Type(scala.Int), Expr(((x: scala.Int) => x)))) Scrutinee: ((x: scala.Int) => x.toString()) Pattern: { - @scala.quoted.internal.Patterns.patternType type T + @scala.quoted.runtime.Patterns.patternType type T - (scala.quoted.internal.Patterns.patternHole[scala.Function1[T, T]]: scala.Function1[scala.Nothing, scala.Any]) + (scala.quoted.runtime.Patterns.patternHole[scala.Function1[T, T]]: scala.Function1[scala.Nothing, scala.Any]) } Result: None Scrutinee: ((x: scala.Any) => scala.Predef.???) Pattern: { - @scala.quoted.internal.Patterns.patternType type T + @scala.quoted.runtime.Patterns.patternType type T - (scala.quoted.internal.Patterns.patternHole[scala.Function1[T, T]]: scala.Function1[scala.Nothing, scala.Any]) + (scala.quoted.runtime.Patterns.patternHole[scala.Function1[T, T]]: scala.Function1[scala.Nothing, scala.Any]) } Result: Some(List(Type(scala.Nothing), Expr(((x: scala.Any) => scala.Predef.???)))) Scrutinee: ((x: scala.Nothing) => (1: scala.Any)) Pattern: { - @scala.quoted.internal.Patterns.patternType type T + @scala.quoted.runtime.Patterns.patternType type T - (scala.quoted.internal.Patterns.patternHole[scala.Function1[T, T]]: scala.Function1[scala.Nothing, scala.Any]) + (scala.quoted.runtime.Patterns.patternHole[scala.Function1[T, T]]: scala.Function1[scala.Nothing, scala.Any]) } Result: None diff --git a/tests/run-macros/quote-matcher-runtime/quoted_1.scala b/tests/run-macros/quote-matcher-runtime/quoted_1.scala index cf3389c8f89e..522d19e57c2a 100644 --- a/tests/run-macros/quote-matcher-runtime/quoted_1.scala +++ b/tests/run-macros/quote-matcher-runtime/quoted_1.scala @@ -7,7 +7,7 @@ object Macros { private def impl[A, B](a: Expr[A], b: Expr[B])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val res = qctx.asInstanceOf[scala.quoted.internal.QuoteMatching].ExprMatch.unapply[Tuple, Tuple](a)(using b).map { tup => + val res = qctx.asInstanceOf[scala.quoted.runtime.QuoteMatching].ExprMatch.unapply[Tuple, Tuple](a)(using b).map { tup => tup.toArray.toList.map { case r: Expr[_] => s"Expr(${r.show})" diff --git a/tests/run-macros/quote-matcher-runtime/quoted_2.scala b/tests/run-macros/quote-matcher-runtime/quoted_2.scala index ea9faee84e00..eef4e106f529 100644 --- a/tests/run-macros/quote-matcher-runtime/quoted_2.scala +++ b/tests/run-macros/quote-matcher-runtime/quoted_2.scala @@ -1,7 +1,7 @@ import Macros._ -import scala.quoted.internal.Patterns._ +import scala.quoted.runtime.Patterns._ object Test { diff --git a/tests/run-macros/quote-type-matcher/quoted_1.scala b/tests/run-macros/quote-type-matcher/quoted_1.scala index 439a28a820a3..0b8f4f0467ee 100644 --- a/tests/run-macros/quote-type-matcher/quoted_1.scala +++ b/tests/run-macros/quote-type-matcher/quoted_1.scala @@ -7,7 +7,7 @@ object Macros { private def matchesExpr[A, B](using a: Type[A], b: Type[B])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val res = qctx.asInstanceOf[scala.quoted.internal.QuoteMatching].TypeMatch.unapply[Tuple, Tuple](a)(using b).map { tup => + val res = qctx.asInstanceOf[scala.quoted.runtime.QuoteMatching].TypeMatch.unapply[Tuple, Tuple](a)(using b).map { tup => tup.toArray.toList.map { case r: Type[_] => s"Type(${TypeTree.of(using r).show})" diff --git a/tests/run-staging/i4730.scala b/tests/run-staging/i4730.scala index 49a21eaa43c6..966e90d175ab 100644 --- a/tests/run-staging/i4730.scala +++ b/tests/run-staging/i4730.scala @@ -5,7 +5,7 @@ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) def ret(using QuoteContext): Expr[Int => Int] = '{ (x: Int) => ${ - val z = run('{x + 1}) // throws scala.quoted.internal.impl.ScopeException => + val z = run('{x + 1}) // throws scala.quoted.runtime.impl.ScopeException => Expr(z) } } @@ -21,7 +21,7 @@ package scala { run(Test.ret).apply(10) throw new Exception } catch { - case ex: Exception if ex.getClass.getName == "scala.quoted.internal.impl.ScopeException" => + case ex: Exception if ex.getClass.getName == "scala.quoted.runtime.impl.ScopeException" => // ok } } diff --git a/tests/run-staging/i6754.scala b/tests/run-staging/i6754.scala index 877366d32a21..aef0b52c9437 100644 --- a/tests/run-staging/i6754.scala +++ b/tests/run-staging/i6754.scala @@ -22,7 +22,7 @@ package scala { throw new Exception } catch { case ex: java.lang.reflect.InvocationTargetException => - assert(ex.getTargetException.getClass.getName == "scala.quoted.internal.impl.ScopeException") + assert(ex.getTargetException.getClass.getName == "scala.quoted.runtime.impl.ScopeException") } } } diff --git a/tests/run-staging/i6992/Macro_1.scala b/tests/run-staging/i6992/Macro_1.scala index 334f4c9c96a3..6481aaeaf1e0 100644 --- a/tests/run-staging/i6992/Macro_1.scala +++ b/tests/run-staging/i6992/Macro_1.scala @@ -25,7 +25,7 @@ package scala { case '{$x: Foo} => Expr(run(x).x) } } catch { - case ex: Exception if ex.getClass.getName == "scala.quoted.internal.impl.ScopeException" => + case ex: Exception if ex.getClass.getName == "scala.quoted.runtime.impl.ScopeException" => '{"OK"} } } diff --git a/tests/run-staging/multi-staging.check b/tests/run-staging/multi-staging.check index a7900c87ff66..2f85879cf975 100644 --- a/tests/run-staging/multi-staging.check +++ b/tests/run-staging/multi-staging.check @@ -1,5 +1,5 @@ stage1 code: ((qctx1: scala.quoted.QuoteContext) ?=> { val x1: scala.Int = 2 - scala.quoted.internal.Expr.quote[scala.Int](1.+(scala.quoted.internal.Expr.nestedSplice[scala.Int](qctx1)(((evidence$5: qctx1.Nested) ?=> scala.quoted.Expr.apply[scala.Int](x1)(evidence$5, scala.quoted.Liftable.IntLiftable[scala.Int]))))).apply(using qctx1) + scala.quoted.runtime.Expr.quote[scala.Int](1.+(scala.quoted.runtime.Expr.nestedSplice[scala.Int](qctx1)(((evidence$5: qctx1.Nested) ?=> scala.quoted.Expr.apply[scala.Int](x1)(evidence$5, scala.quoted.Liftable.IntLiftable[scala.Int]))))).apply(using qctx1) }) 3 diff --git a/tests/run-staging/quote-nested-1.check b/tests/run-staging/quote-nested-1.check index 73bf9f545895..7aa1d3637e5c 100644 --- a/tests/run-staging/quote-nested-1.check +++ b/tests/run-staging/quote-nested-1.check @@ -1 +1 @@ -((qctx: scala.quoted.QuoteContext) ?=> scala.quoted.internal.Expr.quote[scala.Int](3).apply(using qctx)) +((qctx: scala.quoted.QuoteContext) ?=> scala.quoted.runtime.Expr.quote[scala.Int](3).apply(using qctx)) diff --git a/tests/run-staging/quote-nested-2.check b/tests/run-staging/quote-nested-2.check index ccd9b93d03fe..c197cb613e00 100644 --- a/tests/run-staging/quote-nested-2.check +++ b/tests/run-staging/quote-nested-2.check @@ -1,4 +1,4 @@ ((qctx: scala.quoted.QuoteContext) ?=> { - val a: scala.quoted.Expr[scala.Int] = scala.quoted.internal.Expr.quote[scala.Int](4).apply(using qctx) + val a: scala.quoted.Expr[scala.Int] = scala.quoted.runtime.Expr.quote[scala.Int](4).apply(using qctx) ((evidence$2: qctx.Nested) ?=> a).asInstanceOf[scala.ContextFunction1[scala.quoted.QuoteContext, scala.quoted.Expr[scala.Int]]].apply(using qctx) }) diff --git a/tests/run-staging/quote-nested-5.check b/tests/run-staging/quote-nested-5.check index 443c1b39165b..bf4593594e31 100644 --- a/tests/run-staging/quote-nested-5.check +++ b/tests/run-staging/quote-nested-5.check @@ -1,4 +1,4 @@ ((qctx: scala.quoted.QuoteContext) ?=> { - val a: scala.quoted.Expr[scala.Int] = scala.quoted.internal.Expr.quote[scala.Int](4).apply(using qctx) + val a: scala.quoted.Expr[scala.Int] = scala.quoted.runtime.Expr.quote[scala.Int](4).apply(using qctx) ((qctx2: scala.quoted.QuoteContext) ?=> ((evidence$3: qctx2.Nested) ?=> a).asInstanceOf[scala.ContextFunction1[scala.quoted.QuoteContext, scala.quoted.Expr[scala.Int]]].apply(using qctx2)).apply(using qctx) })