From ff8fbb3001a71cfd30b4e9340fbcc9dda168ef19 Mon Sep 17 00:00:00 2001 From: flywind <43030857+xflywind@users.noreply.github.com> Date: Thu, 19 Nov 2020 15:31:54 +0800 Subject: [PATCH] close #14847(add testcase for #14847) (#16045) (cherry picked from commit 1bcc3521371ec6a8c136e42d902a0be7c50d9745) --- tests/macros/t14847.nim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/macros/t14847.nim diff --git a/tests/macros/t14847.nim b/tests/macros/t14847.nim new file mode 100644 index 0000000000..0e6d0dd2de --- /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")