Here's another variant that also fails with the same message (note that there's
no error for the let statement, just the bod call):
template t(body: untyped) =
proc bod(a: int) =
let x {.inject.} = a
body
let x = 1
bod(x)
t:
echo x
Run
If I move the let out of the template, it works:
template t(body: untyped) =
proc bod(a: int) =
let x {.inject.} = a
body
bod(x)
let x = 1
t:
echo x
Run
