diff options
Diffstat (limited to 'tests/macros')
-rw-r--r-- | tests/macros/tgettype.nim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/macros/tgettype.nim b/tests/macros/tgettype.nim new file mode 100644 index 000000000..0eab6c0a0 --- /dev/null +++ b/tests/macros/tgettype.nim @@ -0,0 +1,20 @@ +discard """ +msg: '''ObjectTy(Sym(Model), RecList(Sym(name), Sym(password))) +BracketExpr(Sym(typeDesc), Sym(User))''' +""" +import strutils, macros + +type + Model = object of RootObj + User = object of Model + name : string + password : string + +macro testUser: expr = + return newLit(User.getType.lispRepr) + +macro testGeneric(T: typedesc[Model]): expr = + return newLit(T.getType.lispRepr) + +echo testUser +echo User.testGeneric |