Skip to content

Commit 2f91c59

Browse files
committed
Only transform the body of the quote with QuoteTransformer
1 parent 5a9b616 commit 2f91c59

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,16 @@ class Splicing extends MacroTransform:
8686
override def transform(tree: tpd.Tree)(using Context): tpd.Tree =
8787
assert(level == 0)
8888
tree match
89-
case Apply(Select(_: Quote, nme.apply), _) =>
90-
QuoteTransformer().transform(tree)
89+
case tree: Quote =>
90+
val body1 = QuoteTransformer().transform(tree.body)(using quoteContext)
91+
cpy.Quote(tree)(body = body1)
9192
case tree: DefDef if tree.symbol.is(Inline) =>
9293
// Quotes in inlined methods are only pickled after they are inlined.
9394
tree
9495
case _ =>
9596
super.transform(tree)
9697
end Level0QuoteTransformer
9798

98-
9999
/** Transforms all direct splices in the current quote and replace them with holes. */
100100
private class QuoteTransformer() extends Transformer:
101101
/** Set of definitions in the current quote */
@@ -108,6 +108,7 @@ class Splicing extends MacroTransform:
108108
private val typeHoles = mutable.Map.empty[TermRef, Hole]
109109

110110
override def transform(tree: tpd.Tree)(using Context): tpd.Tree =
111+
assert(level > 0)
111112
tree match
112113
case tree: Splice if level == 1 =>
113114
val holeIdx = numHoles

0 commit comments

Comments
 (0)