@@ -124,7 +124,7 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
124124 *
125125 * See `isCaptured`
126126 */
127- val capturers = new mutable.HashMap [Symbol , RefTree => Tree ]
127+ val capturers = new mutable.HashMap [Symbol , Tree => Tree ]
128128 }
129129
130130 /** The main transformer class
@@ -148,6 +148,9 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
148148 /** We are in a `~(...)` context that is not shadowed by a nested `'(...)` */
149149 def inSplice = outer != null && ! inQuote
150150
151+ /** We are not in a `~(...)` or a `'(...)` */
152+ def isRoot = outer == null
153+
151154 /** A map from type ref T to expressions of type `quoted.Type[T]`".
152155 * These will be turned into splices using `addTags` and represent type variables
153156 * that can be possibly healed.
@@ -295,6 +298,8 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
295298 else i " ${sym.name}.this "
296299 if (! isThis && sym.maybeOwner.isType && ! sym.is(Param ))
297300 check(sym.owner, sym.owner.thisType, pos)
301+ else if (level == 1 && sym.isType && sym.is(Param ) && sym.owner.is(Macro ) && ! outer.isRoot)
302+ importedTags(sym.typeRef) = capturers(sym)(ref(sym))
298303 else if (sym.exists && ! sym.isStaticOwner && ! levelOK(sym))
299304 for (errMsg <- tryHeal(tp, pos))
300305 ctx.error(em """ access to $symStr from wrong staging level:
0 commit comments