Skip to content

Commit 71d40d2

Browse files
committed
Do not change stage of bindings
This was performed to allow some inlined `this` bindings to be evaluated. It was not always possible and hence inconsistent. Now that macros are static methods this is not even possible.
1 parent da8bbea commit 71d40d2

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -521,20 +521,16 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
521521
stats.foreach(markDef)
522522
mapOverTree(last)
523523
case Inlined(call, bindings, InlineSplice(expansion @ Select(body, name))) =>
524-
// To maintain phase consistency, we move the binding of the this parameter into the spliced code
525-
val (splicedBindings, stagedBindings) = bindings.partition {
526-
case vdef: ValDef => vdef.symbol.is(Synthetic) // Assume that only _this bindings are tagged with Synthetic
527-
case _ => false
528-
}
524+
assert(call.symbol.is(Macro))
525+
val spliced =
526+
if (level == 0) Splicer.splice(body, call, bindings, tree.pos).withPos(tree.pos)
527+
else expansion
529528
// Simplification of the call done in PostTyper for non-macros can also be performed now
530529
// see PostTyper `case Inlined(...) =>` for description of the simplification
531530
val call2 =
532531
if (level == 0) Ident(call.symbol.topLevelClass.typeRef).withPos(call.pos)
533532
else call
534-
val tree1 =
535-
if (level == 0) cpy.Inlined(tree)(call2, stagedBindings, Splicer.splice(body, call, splicedBindings, tree.pos).withPos(tree.pos))
536-
else seq(stagedBindings, cpy.Select(expansion)(cpy.Inlined(tree)(call, splicedBindings, body), name))
537-
val tree2 = transform(tree1)
533+
val tree2 = cpy.Inlined(tree)(call2, bindings, transform(spliced))
538534

539535
// due to value-discarding which converts an { e } into { e; () })
540536
if (tree.tpe =:= defn.UnitType) Block(tree2 :: Nil, Literal(Constant(())))

0 commit comments

Comments
 (0)