This code works if let field1 is commented out, but with it it compiles returns
test_deref.nim(19, 9) Error: type mismatch: got (untyped). It seems that the
macro doesn't even run. Is this a bug?
import macros
type
B = object of RootObj
field1: int
type
A[T] = object
inner: T
macro `.`*(obj: A, v): untyped =
echo "running macro"
newDotExpr(newDotExpr(obj, newIdentNode("inner")), newIdentNode(v.strVal))
proc t1*() =
var f: A[B]
let field1 = 777 # <- if you comment this out, the code works
echo f.field1
t1()