Replacing `proc` with `untyped` will fix it. macro mkCaster(caster: untyped) Run
It seems that all the symbols were bound to somewhere before passed into the macro, as a side effect of using typed parameter. The compile thus thought you were capturing outter variables.