diff options
-rw-r--r-- | lib/pure/asyncmacro.nim | 2 | ||||
-rw-r--r-- | tests/async/ttemplateinasync.nim | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/pure/asyncmacro.nim b/lib/pure/asyncmacro.nim index 1a45fdac7..9acd4bd79 100644 --- a/lib/pure/asyncmacro.nim +++ b/lib/pure/asyncmacro.nim @@ -177,7 +177,7 @@ proc processBody(node, retFutureSym: NimNode, var newDiscard = node result.createVar("futureDiscard_" & $toStrLit(node[0][1]), node[0][1], newDiscard[0], newDiscard, node) - of RoutineNodes: + of RoutineNodes-{nnkTemplateDef}: # skip all the nested procedure definitions return else: discard diff --git a/tests/async/ttemplateinasync.nim b/tests/async/ttemplateinasync.nim new file mode 100644 index 000000000..f4a2da538 --- /dev/null +++ b/tests/async/ttemplateinasync.nim @@ -0,0 +1,11 @@ +discard """ + output: 42 +""" + +import asyncdispatch + +proc foo(): Future[int] {.async.} = + template ret() = return 42 + ret() + +echo (waitFor foo()) |