@@ -21,6 +21,10 @@ class ReifyQuotes extends MacroTransform {
21
21
22
22
protected def newTransformer (implicit ctx : Context ): Transformer = new Reifier
23
23
24
+ /** is tree splice operation? */
25
+ def isSplice (tree : Select )(implicit ctx : Context ) =
26
+ tree.symbol == defn.QuotedExpr_~ || tree.symbol == defn.QuotedType_~
27
+
24
28
/** Serialize `tree`. Embedded splices are represented as nodes of the form
25
29
*
26
30
* Select(qual, sym)
@@ -112,8 +116,7 @@ class ReifyQuotes extends MacroTransform {
112
116
inQuote(reifyCall(transform(arg), isType = false ))
113
117
case TypeApply (fn, arg :: Nil ) if fn.symbol == defn.typeQuoteMethod =>
114
118
inQuote(reifyCall(transform(arg), isType = true ))
115
- case Select (body, name)
116
- if tree.symbol == defn.QuotedExpr_~ || tree.symbol == defn.QuotedType_~ =>
119
+ case tree @ Select (body, name) if isSplice(tree) =>
117
120
currentLevel -= 1
118
121
val body1 = try transform(body) finally currentLevel += 1
119
122
if (currentLevel > 0 ) {
@@ -140,6 +143,10 @@ class ReifyQuotes extends MacroTransform {
140
143
levelOf -= enteredSyms.head
141
144
enteredSyms = enteredSyms.tail
142
145
}
146
+ case Inlined (call, bindings, expansion @ Select (body, name)) if isSplice(expansion) =>
147
+ // To maintain phase consistency, convert inlined expressions of the form
148
+ // `{ bindings; ~expansion }` to `~{ bindings; expansion }`
149
+ cpy.Select (expansion)(cpy.Inlined (tree)(call, bindings, body), name)
143
150
case _ : Import =>
144
151
tree
145
152
case _ =>
0 commit comments