"match" hygiene mismatch inside nested cases
Created by: trxcllnt
If a case macro is created in the body of an outer case macro, the inner cases' syntax
invocations are renaming their match
identifiers to an undefined reference. I imagine this is because syntax
breaks hygiene to capture match
inside syntaxCase
.
Here's my example:
macroclass inv { pattern { rule { .$fn($args ...) } } }
macro extends_macro {
case infix { $Macro | _ $Parent { $rules ... } } => {
var rules = #{ $rules ... }.concat(#{
case { _ $inv:inv $[...] ; } => {
console.clear();
console.log("breaks after this");
return #{
$Parent .$inv$fn($inv$args $[...]);
}
}
});
return withSyntax($macro_rules ... = rules) #{
macro $Macro { $macro_rules ... }
}
}
}
macro Base {
rule { .foo(); } => { console.log("foo"); }
}
Impl extends_macro Base {
case { _ .bar(); } => { return #{ console.log("bar"); } }
}
Impl.foo().bar();