Skip to content

Rename ReifyQuotes to PickleQuotes #10261

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
8 changes: 4 additions & 4 deletions compiler/src/dotty/tools/dotc/core/Phases.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = _
Expand All @@ -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
Expand All @@ -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])
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/Staging.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/internals/overall-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/reference/metaprogramming/macros-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion library/src-bootstrapped/scala/quoted/Type.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion library/src-non-bootstrapped/scala/quoted/Type.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]) = ???
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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` */
Expand Down
4 changes: 2 additions & 2 deletions staging/src/scala/quoted/staging/QuoteCompiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions tests/plugins/custom/analyzer/Analyzer_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/plugins/neg/divideZero/plugin_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions tests/pos-macros/i8100.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]) = ???
2 changes: 1 addition & 1 deletion tests/run/opaque-immutable-array-xm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down