close #14847(add testcase for #14847) (#16045)

This commit is contained in:
flywind 2020-11-19 15:31:54 +08:00 • committed by GitHub
commit 1bcc352137
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

20
tests/macros/t14847.nim Normal file
View file

@ -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")