Now here is problem how to pass typedesc to template:
template create(x: int, T: typedesc): untyped = T(age: x)
macro m2(T: typedesc): untyped =
let nT = quote do: `T` #Sym "User"
let t1 = T.getType()[1] #Sym "User"
let t2 = bindSym"User" #Sym "User"
# all of the following code is ERROR!
#result = getAst create(10, t2)
#result = getAst create(10, t1)
#result = getAst create(10, T)
#result = getAst create(10, nT)
#result = getAst create(10, ident("User"))
result = getAst create(10, User)
#echo create(User, 10) # OK!
echo m2(User)
All the code of the getAst call result ERROR.