summary refs log tree commit diff stats
path: root/tests/macros/macro_bug.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/macros/macro_bug.nim')
-rw-r--r--tests/macros/macro_bug.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/macros/macro_bug.nim b/tests/macros/macro_bug.nim
new file mode 100644
index 000000000..c723a4ab6
--- /dev/null
+++ b/tests/macros/macro_bug.nim
@@ -0,0 +1,18 @@
+import macros
+
+macro macro_bug*(s: untyped) =
+  echo s.treeRepr
+  s.expectKind({nnkProcDef, nnkMethodDef})
+
+  var params = s.params
+
+  let genericParams = s[2]
+  result = newNimNode(nnkProcDef).add(
+    s.name, s[1], genericParams, params, pragma(s), newEmptyNode())
+
+  # don't really do anything
+  var body = body(s)
+  result.add(body)
+
+  echo "result:"
+  echo result.repr