If you run this code with code with strutils imported the input arg is treated as typed instead of untyped. import macros import strutils macro replace(input: untyped, before: untyped, after: untyped) : untyped = echo treeRepr input echo treeRepr before echo treeRepr after var x = 10 var y = 20 replace do: for i in 0..5: x += 5 y += 15 do: x += 5 y += 15 do: x += 5 echo x echo y
but if instead you comment out strutils input goes back to being untyped. nnkIdents become nnkSyms instead of staying as nnkIdents.