From 4e61c3265faa71dcb6feb5c64293362ece9bc4d3 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 10 Nov 2020 08:44:36 +0100 Subject: [PATCH] Rename ReifyQuotes to PickleQuotes --- compiler/src/dotty/tools/dotc/Compiler.scala | 2 +- compiler/src/dotty/tools/dotc/core/Phases.scala | 8 ++++---- .../src/dotty/tools/dotc/quoted/PickledQuotes.scala | 2 +- .../{ReifyQuotes.scala => PickleQuotes.scala} | 10 +++++----- compiler/src/dotty/tools/dotc/transform/Staging.scala | 2 +- docs/docs/internals/overall-structure.md | 2 +- docs/docs/reference/metaprogramming/macros-spec.md | 2 +- .../scala/internal/quoted/CompileTime.scala | 2 +- library/src-bootstrapped/scala/quoted/Type.scala | 2 +- library/src-non-bootstrapped/scala/quoted/Type.scala | 2 +- .../sbt-dotty/analyzer-plugin/plugin/SetDefTree.scala | 4 ++-- .../analyzer-plugin/plugin/SetDefTreeOff.scala | 2 +- staging/src/scala/quoted/staging/QuoteCompiler.scala | 4 ++-- tests/plugins/custom/analyzer/Analyzer_1.scala | 4 ++-- tests/plugins/neg/divideZero/plugin_1.scala | 4 ++-- tests/pos-macros/i8100.scala | 4 ++-- tests/run/opaque-immutable-array-xm.scala | 2 +- 17 files changed, 29 insertions(+), 29 deletions(-) rename compiler/src/dotty/tools/dotc/transform/{ReifyQuotes.scala => PickleQuotes.scala} (99%) diff --git a/compiler/src/dotty/tools/dotc/Compiler.scala b/compiler/src/dotty/tools/dotc/Compiler.scala index b83e4a9557f7..5e0e711febe0 100644 --- a/compiler/src/dotty/tools/dotc/Compiler.scala +++ b/compiler/src/dotty/tools/dotc/Compiler.scala @@ -50,7 +50,7 @@ class Compiler { /** Phases dealing with TASTY tree pickling and unpickling */ protected def picklerPhases: List[List[Phase]] = List(new Pickler) :: // Generate TASTY info - List(new ReifyQuotes) :: // Turn quoted trees into explicit run-time data structures + List(new PickleQuotes) :: // Turn quoted trees into explicit run-time data structures Nil /** Phases dealing with the transformation from pickled trees to backend trees */ diff --git a/compiler/src/dotty/tools/dotc/core/Phases.scala b/compiler/src/dotty/tools/dotc/core/Phases.scala index b3738dfbf056..c92077874b80 100644 --- a/compiler/src/dotty/tools/dotc/core/Phases.scala +++ b/compiler/src/dotty/tools/dotc/core/Phases.scala @@ -197,7 +197,7 @@ object Phases { private var myPostTyperPhase: Phase = _ private var mySbtExtractDependenciesPhase: Phase = _ private var myPicklerPhase: Phase = _ - private var myReifyQuotesPhase: Phase = _ + private var myPickleQuotesPhase: Phase = _ private var myCollectNullableFieldsPhase: Phase = _ private var myRefChecksPhase: Phase = _ private var myPatmatPhase: Phase = _ @@ -216,7 +216,7 @@ object Phases { final def postTyperPhase: Phase = myPostTyperPhase final def sbtExtractDependenciesPhase: Phase = mySbtExtractDependenciesPhase final def picklerPhase: Phase = myPicklerPhase - final def reifyQuotesPhase: Phase = myReifyQuotesPhase + final def pickleQuotesPhase: Phase = myPickleQuotesPhase final def collectNullableFieldsPhase: Phase = myCollectNullableFieldsPhase final def refchecksPhase: Phase = myRefChecksPhase final def patmatPhase: Phase = myPatmatPhase @@ -238,7 +238,7 @@ object Phases { myPostTyperPhase = phaseOfClass(classOf[PostTyper]) mySbtExtractDependenciesPhase = phaseOfClass(classOf[sbt.ExtractDependencies]) myPicklerPhase = phaseOfClass(classOf[Pickler]) - myReifyQuotesPhase = phaseOfClass(classOf[ReifyQuotes]) + myPickleQuotesPhase = phaseOfClass(classOf[PickleQuotes]) myCollectNullableFieldsPhase = phaseOfClass(classOf[CollectNullableFields]) myRefChecksPhase = phaseOfClass(classOf[RefChecks]) myElimRepeatedPhase = phaseOfClass(classOf[ElimRepeated]) @@ -402,7 +402,7 @@ object Phases { def postTyperPhase(using Context): Phase = ctx.base.postTyperPhase def sbtExtractDependenciesPhase(using Context): Phase = ctx.base.sbtExtractDependenciesPhase def picklerPhase(using Context): Phase = ctx.base.picklerPhase - def reifyQuotesPhase(using Context): Phase = ctx.base.reifyQuotesPhase + def pickleQuotesPhase(using Context): Phase = ctx.base.pickleQuotesPhase def refchecksPhase(using Context): Phase = ctx.base.refchecksPhase def elimRepeatedPhase(using Context): Phase = ctx.base.elimRepeatedPhase def extensionMethodsPhase(using Context): Phase = ctx.base.extensionMethodsPhase diff --git a/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala b/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala index f40f010391cc..3748e0f99f36 100644 --- a/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala +++ b/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala @@ -87,7 +87,7 @@ object PickledQuotes { if filled.source == ctx.source then filled else filled.cloneIn(ctx.source).withSpan(tree.span) else - // Replaces type holes generated by ReifyQuotes (non-spliced types). + // Replaces type holes generated by PickleQuotes (non-spliced types). // These are types defined in a quote and used at the same level in a nested quote. val quotedType = pickledQuote.typeSplice(idx)(reifiedArgs) PickledQuotes.quotedTypeToTree(quotedType) diff --git a/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala b/compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala similarity index 99% rename from compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala rename to compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala index 5bc9dd0abbdd..73fb7823f92e 100644 --- a/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala +++ b/compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala @@ -64,11 +64,11 @@ import scala.annotation.constructorOnly * and then performs the same transformation on `'{ ... ${x1$1} ... ${x2$1} ...}`. * */ -class ReifyQuotes extends MacroTransform { - import ReifyQuotes._ +class PickleQuotes extends MacroTransform { + import PickleQuotes._ import tpd._ - override def phaseName: String = ReifyQuotes.name + override def phaseName: String = PickleQuotes.name override def allowsImplicitSearch: Boolean = true @@ -463,10 +463,10 @@ class ReifyQuotes extends MacroTransform { } -object ReifyQuotes { +object PickleQuotes { import tpd._ - val name: String = "reifyQuotes" + val name: String = "pickleQuotes" def getLiteral(tree: tpd.Tree): Option[Literal] = tree match { case tree: Literal => Some(tree) diff --git a/compiler/src/dotty/tools/dotc/transform/Staging.scala b/compiler/src/dotty/tools/dotc/transform/Staging.scala index 7878cf1d9dd8..1fa3231cf1ef 100644 --- a/compiler/src/dotty/tools/dotc/transform/Staging.scala +++ b/compiler/src/dotty/tools/dotc/transform/Staging.scala @@ -38,7 +38,7 @@ class Staging extends MacroTransform { override def allowsImplicitSearch: Boolean = true override def checkPostCondition(tree: Tree)(using Context): Unit = - if (ctx.phase <= reifyQuotesPhase) { + if (ctx.phase <= pickleQuotesPhase) { // Recheck that PCP holds but do not heal any inconsistent types as they should already have been heald tree match { case PackageDef(pid, _) if tree.symbol.owner == defn.RootClass => diff --git a/docs/docs/internals/overall-structure.md b/docs/docs/internals/overall-structure.md index 190dfe5814f6..94f14062a35d 100644 --- a/docs/docs/internals/overall-structure.md +++ b/docs/docs/internals/overall-structure.md @@ -110,7 +110,7 @@ phases. The current list of phases is specified in class [Compiler] as follows: /** Phases dealing with TASTY tree pickling and unpickling */ protected def picklerPhases: List[List[Phase]] = List(new Pickler) :: // Generate TASTY info - List(new ReifyQuotes) :: // Turn quoted trees into explicit run-time data structures + List(new PickleQuotes) :: // Turn quoted trees into explicit run-time data structures Nil /** Phases dealing with the transformation from pickled trees to backend trees */ diff --git a/docs/docs/reference/metaprogramming/macros-spec.md b/docs/docs/reference/metaprogramming/macros-spec.md index 456e530eeeb4..b902840e3d1c 100644 --- a/docs/docs/reference/metaprogramming/macros-spec.md +++ b/docs/docs/reference/metaprogramming/macros-spec.md @@ -25,7 +25,7 @@ a quoted expression or type is treated as a splice `${x}` and a quoted identifie Quotes and splices are primitive forms in the generated abstract syntax trees. Top-level splices are eliminated during macro expansion while typing. On the -other hand, top-level quotes are eliminated in an expansion phase `ReifyQuotes` +other hand, top-level quotes are eliminated in an expansion phase `PickleQuotes` phase (after typing and pickling). PCP checking occurs while preparing the RHS of an inline method for top-level splices and in the `Staging` phase (after typing and before pickling). diff --git a/library/src-bootstrapped/scala/internal/quoted/CompileTime.scala b/library/src-bootstrapped/scala/internal/quoted/CompileTime.scala index e6e6972481d5..d7034b80b8a3 100644 --- a/library/src-bootstrapped/scala/internal/quoted/CompileTime.scala +++ b/library/src-bootstrapped/scala/internal/quoted/CompileTime.scala @@ -26,7 +26,7 @@ object CompileTime { * `'{ @quoteTypeTag type T$1 = $t ... F[T$1] ... }` to have a tree for `$t`. * This artifact is removed during quote unpickling. * - * See ReifyQuotes.scala and PickledQuotes.scala + * See PickleQuotes.scala and PickledQuotes.scala */ @compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.quoteTypeTag`") class quoteTypeTag extends Annotation diff --git a/library/src-bootstrapped/scala/quoted/Type.scala b/library/src-bootstrapped/scala/quoted/Type.scala index 27f18821bd90..b9c57d0ebaa3 100644 --- a/library/src-bootstrapped/scala/quoted/Type.scala +++ b/library/src-bootstrapped/scala/quoted/Type.scala @@ -20,7 +20,7 @@ object Type: qctx.reflect.TypeTree.of[T].showAnsiColored /** Return a quoted.Type with the given type */ - @compileTimeOnly("Reference to `scala.quoted.Type.apply` was not handled by ReifyQuotes") + @compileTimeOnly("Reference to `scala.quoted.Type.apply` was not handled by PickleQuotes") given apply[T <: AnyKind] as (QuoteContext ?=> Type[T]) = ??? end Type diff --git a/library/src-non-bootstrapped/scala/quoted/Type.scala b/library/src-non-bootstrapped/scala/quoted/Type.scala index 8aaad0aeff04..54aebe90536b 100644 --- a/library/src-non-bootstrapped/scala/quoted/Type.scala +++ b/library/src-non-bootstrapped/scala/quoted/Type.scala @@ -6,5 +6,5 @@ abstract class Type[T <: AnyKind] private[scala]: type Underlying = T object Type: - @compileTimeOnly("Reference to `scala.quoted.Type.apply` was not handled by ReifyQuotes") + @compileTimeOnly("Reference to `scala.quoted.Type.apply` was not handled by PickleQuotes") given apply[T <: AnyKind] as (QuoteContext ?=> Type[T]) = ??? diff --git a/sbt-dotty/sbt-test/sbt-dotty/analyzer-plugin/plugin/SetDefTree.scala b/sbt-dotty/sbt-test/sbt-dotty/analyzer-plugin/plugin/SetDefTree.scala index bc11dcb4666b..b1181b7b6e1f 100644 --- a/sbt-dotty/sbt-test/sbt-dotty/analyzer-plugin/plugin/SetDefTree.scala +++ b/sbt-dotty/sbt-test/sbt-dotty/analyzer-plugin/plugin/SetDefTree.scala @@ -3,7 +3,7 @@ package analyzer import dotty.tools.dotc.ast.tpd import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.transform.MegaPhase._ -import dotty.tools.dotc.transform.{ReifyQuotes, FirstTransform} +import dotty.tools.dotc.transform.{PickleQuotes, FirstTransform} import dotty.tools.dotc.plugins._ /** Set the `defTree` property of symbols for compile plugins @@ -16,7 +16,7 @@ class SetDefTree extends PluginPhase { import tpd._ override val phaseName: String = SetDefTree.name - override def runsAfter: Set[String] = Set(ReifyQuotes.name) + override def runsAfter: Set[String] = Set(PickleQuotes.name) override def runsBefore: Set[String] = Set(FirstTransform.name) // don't allow plugins to change tasty // research plugins can still change the phase plan at will diff --git a/sbt-dotty/sbt-test/sbt-dotty/analyzer-plugin/plugin/SetDefTreeOff.scala b/sbt-dotty/sbt-test/sbt-dotty/analyzer-plugin/plugin/SetDefTreeOff.scala index b1f70f69807b..87c8208ea78a 100644 --- a/sbt-dotty/sbt-test/sbt-dotty/analyzer-plugin/plugin/SetDefTreeOff.scala +++ b/sbt-dotty/sbt-test/sbt-dotty/analyzer-plugin/plugin/SetDefTreeOff.scala @@ -3,7 +3,7 @@ package analyzer import dotty.tools.dotc.ast.tpd import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.transform.MegaPhase._ -import dotty.tools.dotc.transform.{ReifyQuotes, FirstTransform} +import dotty.tools.dotc.transform.{PickleQuotes, FirstTransform} import dotty.tools.dotc.plugins._ /** Unset the `defTree` property of symbols. See the doc for `SetDefTree` */ diff --git a/staging/src/scala/quoted/staging/QuoteCompiler.scala b/staging/src/scala/quoted/staging/QuoteCompiler.scala index 5f8c31c8c6ba..8ff5669b3d9e 100644 --- a/staging/src/scala/quoted/staging/QuoteCompiler.scala +++ b/staging/src/scala/quoted/staging/QuoteCompiler.scala @@ -16,7 +16,7 @@ import dotty.tools.dotc.core.Symbols._ import dotty.tools.dotc.core.Types.ExprType import dotty.tools.dotc.quoted.PickledQuotes import dotty.tools.dotc.transform.Splicer.checkEscapedVariables -import dotty.tools.dotc.transform.ReifyQuotes +import dotty.tools.dotc.transform.PickleQuotes import dotty.tools.dotc.util.Spans.Span import dotty.tools.dotc.util.SourceFile import dotty.tools.io.{Path, VirtualFile} @@ -37,7 +37,7 @@ private class QuoteCompiler extends Compiler: List(List(new QuotedFrontend)) override protected def picklerPhases: List[List[Phase]] = - List(List(new ReifyQuotes)) + List(List(new PickleQuotes)) override def newRun(implicit ctx: Context): ExprRun = reset() diff --git a/tests/plugins/custom/analyzer/Analyzer_1.scala b/tests/plugins/custom/analyzer/Analyzer_1.scala index 6faecc2ff2f9..8c7cea47f0f6 100644 --- a/tests/plugins/custom/analyzer/Analyzer_1.scala +++ b/tests/plugins/custom/analyzer/Analyzer_1.scala @@ -19,13 +19,13 @@ import Decorators._ import Symbols.{Symbol, requiredPackage} import Constants.Constant import Types._ -import transform.{ReifyQuotes, FirstTransform} +import transform.{PickleQuotes, FirstTransform} class SetDefTree extends PluginPhase { import tpd._ override val phaseName: String = SetDefTree.name - override def runsAfter: Set[String] = Set(ReifyQuotes.name) + override def runsAfter: Set[String] = Set(PickleQuotes.name) override def runsBefore: Set[String] = Set(FirstTransform.name) // don't allow plugins to change tasty // research plugins can still change the phase plan at will diff --git a/tests/plugins/neg/divideZero/plugin_1.scala b/tests/plugins/neg/divideZero/plugin_1.scala index 764221aeafca..0ca48c3e4a32 100644 --- a/tests/plugins/neg/divideZero/plugin_1.scala +++ b/tests/plugins/neg/divideZero/plugin_1.scala @@ -8,7 +8,7 @@ import transform.MegaPhase.MiniPhase import Decorators._ import Symbols.{Symbol, requiredClass} import Constants.Constant -import transform.{Pickler, ReifyQuotes} +import transform.{Pickler, PickleQuotes} import StdNames._ class DivideZero extends PluginPhase with StandardPlugin { @@ -18,7 +18,7 @@ class DivideZero extends PluginPhase with StandardPlugin { val phaseName = name override val runsAfter = Set(Pickler.name) - override val runsBefore = Set(ReifyQuotes.name) + override val runsBefore = Set(PickleQuotes.name) override def init(options: List[String]): List[PluginPhase] = this :: Nil diff --git a/tests/pos-macros/i8100.scala b/tests/pos-macros/i8100.scala index b9517d9ccef0..7e4f0330cbaa 100644 --- a/tests/pos-macros/i8100.scala +++ b/tests/pos-macros/i8100.scala @@ -14,8 +14,8 @@ def f[T: Type](using QuoteContext) = ${ g[m.E](using Type[ME]) } ${ g[ME](using Type[m.E]) } ${ g[m.E](using Type[m.E]) } - // ${ g[ME] } // FIXME: issue seems to be in ReifyQuotes - // ${ g[m.E] } // FIXME: issue seems to be in ReifyQuotes + // ${ g[ME] } // FIXME: issue seems to be in PickleQuotes + // ${ g[m.E] } // FIXME: issue seems to be in PickleQuotes } def g[T](using Type[T]) = ??? diff --git a/tests/run/opaque-immutable-array-xm.scala b/tests/run/opaque-immutable-array-xm.scala index 49e131afcf00..bca0b050806e 100644 --- a/tests/run/opaque-immutable-array-xm.scala +++ b/tests/run/opaque-immutable-array-xm.scala @@ -10,7 +10,7 @@ object Test extends App { def apply[A: ClassTag](xs: A*): IArray[A] = initialize(Array(xs: _*)) // These should be inline but that does not work currently. Try again - // once inliner is moved to ReifyQuotes + // once inliner is moved to PickleQuotes extension [A](ia: IArray[A]) def length: Int = (ia: Array[A]).length extension [A](ia: IArray[A]) def apply (i: Int): A = (ia: Array[A])(i)