summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-11-19 15:31:54 +0800
committerGitHub <noreply@github.com>2020-11-19 08:31:54 +0100
commit1bcc3521371ec6a8c136e42d902a0be7c50d9745 (patch)
treed627248e57d32f7b262803e9d02e77170b52a585
parent743f2f5faabecc8ed86837d7ae39319300c68817 (diff)
downloadNim-1bcc3521371ec6a8c136e42d902a0be7c50d9745.tar.gz
close #14847(add testcase for #14847) (#16045)
-rw-r--r--tests/macros/t14847.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/macros/t14847.nim b/tests/macros/t14847.nim
new file mode 100644
index 000000000..0e6d0dd2d
--- /dev/null
+++ b/tests/macros/t14847.nim
@@ -0,0 +1,20 @@
+discard """
+  output: "98"
+"""
+import macros
+
+#bug #14847
+proc hello*(b: string) =
+  echo b
+
+macro dispatch(pro: typed, params: untyped): untyped =
+  var impl = pro.getImpl
+  let id = ident(pro.strVal & "_coverage")
+  impl[0] = id
+  let call = newCall(id, params)
+
+  result = newStmtList()
+  result.add(impl)
+  result.add(call)
+
+dispatch(hello, "98")