macro inspect(x: typed): untyped =
macro payload(e: typed): untyped =
echo e.treeRepr
e
echo payload(1 + x.intVal)
inspect(2)
# first prints the right results for payload calls, then:
# Error: cannot generate VM code for macro payload(e: typed): untyped
Am I misunderstanding what compiler says? It seems to me it says the payload macro will not be compiled... but somehow it is still executed?
The problem vanishes if the payload macro is not defined inside another macro:
macro payload(e: typed): untyped =
echo e.treeRepr
e
macro inspect(x: typed): untyped =
echo payload(1 + x.intVal)
inspect(2)
# prints right results with no errors
It seems to me it works like that for any inner macro. Is it a bug?