Hi there,
I have something like:
import std/macros
template someTemplate(body: untyped) =
macro someInnerMacro(innerBody: untyped) {.inject.} =
newCall(ident"echo", newLit(innerBody.repr))
body
proc test[T](x: T) =
someTemplate:
someInnerMacro y
test 1
Run
which fails with:
Error: undeclared identifier: 'y'
Run
this seems to only happen if the proc is generic, the template has an inner
template/macro and the body of the template isnt semantically correct.
So this works:
proc test(x: int) =
someTemplate:
someInnerMacro y
Run
and this works:
proc test[T](x: T) =
someTemplate:
someInnerMacro x
Run
so this seems to me like a bug, but maybe Im missing something and this is
expected behavior