summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/pure/asyncmacro.nim2
-rw-r--r--tests/async/t9201.nim14
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/pure/asyncmacro.nim b/lib/pure/asyncmacro.nim
index 9acd4bd79..b18d20d55 100644
--- a/lib/pure/asyncmacro.nim
+++ b/lib/pure/asyncmacro.nim
@@ -190,7 +190,7 @@ proc getName(node: NimNode): string {.compileTime.} =
   case node.kind
   of nnkPostfix:
     return node[1].strVal
-  of nnkIdent:
+  of nnkIdent, nnkSym:
     return node.strVal
   of nnkEmpty:
     return "anonymous"
diff --git a/tests/async/t9201.nim b/tests/async/t9201.nim
new file mode 100644
index 000000000..5aaba7063
--- /dev/null
+++ b/tests/async/t9201.nim
@@ -0,0 +1,14 @@
+discard """
+  exitcode: 0
+"""
+
+# Derived from issue #9201
+import asyncdispatch, macros
+
+macro newAsyncProc(name: untyped): untyped =
+  expectKind name, nnkStrLit
+  let pName = genSym(nskProc, name.strVal)
+  result = getAst async quote do:
+    proc `pName`() = discard
+
+newAsyncProc("hello")