Skip to content

Commit 8d634fe

Browse files
committed
Re-architecture quote pickling
Split cross quote reference handling from pickling Fixes #8100 Fixes #12440
1 parent 73f099f commit 8d634fe

File tree

7 files changed

+690
-6
lines changed

7 files changed

+690
-6
lines changed

compiler/src/dotty/tools/dotc/Compiler.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ class Compiler {
5252
List(new Inlining) :: // Inline and execute macros
5353
List(new PostInlining) :: // Add mirror support for inlined code
5454
List(new Staging) :: // Check staging levels and heal staged types
55-
List(new PickleQuotes) :: // Turn quoted trees into explicit run-time data structures
55+
List(new Splicing) :: // Turn quoted trees into explicit run-time data structures
56+
List(new PickleQuotes2) :: // Turn quoted trees into explicit run-time data structures
57+
// List(new PickleQuotes) :: // Turn quoted trees into explicit run-time data structures
5658
Nil
5759

5860
/** Phases dealing with the transformation from pickled trees to backend trees */

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ object PickledQuotes {
5555
/** Unpickle the tree contained in the TastyExpr */
5656
def unpickleTerm(pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.Quotes) => scala.quoted.Expr[?])(using Context): Tree = {
5757
val unpickled = withMode(Mode.ReadPositions)(unpickle(pickled, isType = false))
58-
val Inlined(call, Nil, expnasion) = unpickled
58+
val Inlined(call, Nil, expansion0) = unpickled
5959
val inlineCtx = inlineContext(call)
60-
val expansion1 = spliceTypes(expnasion, typeHole, termHole)(using inlineCtx)
60+
val expansion1 = spliceTypes(expansion0, typeHole, termHole)(using inlineCtx)
6161
val expansion2 = spliceTerms(expansion1, typeHole, termHole)(using inlineCtx)
6262
cpy.Inlined(unpickled)(call, Nil, expansion2)
6363
}
@@ -75,7 +75,7 @@ object PickledQuotes {
7575
case Hole(isTerm, idx, args) =>
7676
inContext(SpliceScope.contextWithNewSpliceScope(tree.sourcePos)) {
7777
val reifiedArgs = args.map { arg =>
78-
if (arg.isTerm) (q: Quotes) ?=> new ExprImpl(arg, SpliceScope.getCurrent)
78+
if (arg.isTerm) new ExprImpl(arg, SpliceScope.getCurrent)
7979
else new TypeImpl(arg, SpliceScope.getCurrent)
8080
}
8181
if isTerm then

0 commit comments

Comments
 (0)