captured NimNode becomes NilLit
levovix0 opened this issue · comments
Александр Старочкин commented
Description
macro foo(arg: int): int =
proc impl(): NimNode = arg
impl()
echo foo(11)
invalidly captures arg into impl
Nim Version
Nim Compiler Version 2.0.4 [Linux: amd64]
Compiled at 2024-03-28
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: b47747d
active boot switches: -d:release
Current Output
a.nim(5, 9) template/generic instantiation of `foo` from here
a.nim(3, 3) Error: type mismatch: got 'NimNode' for 'nil' but expected 'int'
Expected Output
11
Possible Solution
No response
Additional Information
after calling impl(), both impl().treeRepr
and arg.treeRepr
is NilLit