@@ -120,7 +120,7 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
120120 *
121121 * See `isCaptured`
122122 */
123- val capturers = new mutable.HashMap [Symbol , RefTree => Tree ]
123+ val capturers = new mutable.HashMap [Symbol , Tree => Tree ]
124124 }
125125
126126 /** The main transformer class
@@ -144,6 +144,9 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
144144 /** We are in a `~(...)` context that is not shadowed by a nested `'(...)` */
145145 def inSplice = outer != null && ! inQuote
146146
147+ /** We are not in a `~(...)` or a `'(...)` */
148+ def isRoot = outer != null
149+
147150 /** A map from type ref T to expressions of type `quoted.Type[T]`".
148151 * These will be turned into splices using `addTags` and represent type variables
149152 * that can be possibly healed.
@@ -291,6 +294,8 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
291294 else i " ${sym.name}.this "
292295 if (! isThis && sym.maybeOwner.isType && ! sym.is(Param ))
293296 check(sym.owner, sym.owner.thisType, pos)
297+ else if (level == 1 && sym.isType && sym.is(Param ) && sym.owner.is(Macro ) && outer.isRoot)
298+ importedTags(sym.typeRef) = capturers(sym)(ref(sym))
294299 else if (sym.exists && ! sym.isStaticOwner && ! levelOK(sym))
295300 for (errMsg <- tryHeal(tp, pos))
296301 ctx.error(em """ access to $symStr from wrong staging level:
0 commit comments