summary refs log tree commit diff stats
path: root/tests/macros
diff options
context:
space:
mode:
authorcooldome <cdome@bk.ru>2018-07-12 11:03:08 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-07-12 11:03:08 +0200
commit231a83a6b108dc676b53ba5f906d51ff14aa5b51 (patch)
treebaeb423ff0d363edb2ad8e70c43b3ffe2293d9a4 /tests/macros
parentac3c4a94add9e21e9f0731f39be88cdba2bec010 (diff)
downloadNim-231a83a6b108dc676b53ba5f906d51ff14aa5b51.tar.gz
Fixes #8287 (#8288)
Diffstat (limited to 'tests/macros')
-rw-r--r--tests/macros/tmacrostmt.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/macros/tmacrostmt.nim b/tests/macros/tmacrostmt.nim
index 849a32ea3..a6e1e66dd 100644
--- a/tests/macros/tmacrostmt.nim
+++ b/tests/macros/tmacrostmt.nim
@@ -24,3 +24,23 @@ macro foo: typed =
   else: echo "Does not compute! (test OK)"
 
 foo()
+
+#------------------------------------
+# bug #8287 
+type MyString = distinct string
+
+proc `$` (c: MyString): string {.borrow.}
+
+proc `!!` (c: cstring): int =
+  c.len
+
+proc f(name: MyString): int =
+  !! $ name
+
+macro repr_and_parse(fn: typed): typed =
+  let fn_impl = fn.getImpl
+  fn_impl.name = genSym(nskProc, $fn_impl.name)
+  echo fn_impl.repr
+  result = parseStmt(fn_impl.repr)
+
+repr_and_parse(f)
\ No newline at end of file