summary refs log tree commit diff stats
path: root/tests/async
diff options
context:
space:
mode:
authorArdek Romak <ardek66@tutanota.com>2021-03-30 09:07:45 +0300
committerGitHub <noreply@github.com>2021-03-30 08:07:45 +0200
commit9e88425d7c5e3edfcbddedbe062c5f028789a002 (patch)
tree4bbcbd0ee86597a78221098dda3b70a36c1467be /tests/async
parenta672ec3c9e25159d3482aebfe1d0bb4271910869 (diff)
downloadNim-9e88425d7c5e3edfcbddedbe062c5f028789a002.tar.gz
Fix void async in templates (#17562)
* Fix https://github.com/nim-lang/Nim/issues/16159
* Add test for async in template
* Shorten the expression
* Even shorter

Co-authored-by: Clyybber <darkmine956@gmail.com>
Diffstat (limited to 'tests/async')
-rw-r--r--tests/async/tasyncintemplate.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/async/tasyncintemplate.nim b/tests/async/tasyncintemplate.nim
new file mode 100644
index 000000000..31f4cd95c
--- /dev/null
+++ b/tests/async/tasyncintemplate.nim
@@ -0,0 +1,12 @@
+discard """
+  output: 42
+"""
+
+import asyncdispatch
+
+template foo() =
+  proc temp(): Future[int] {.async.} = return 42
+  proc tempVoid(): Future[void] {.async.} = echo await temp()
+
+foo()
+waitFor tempVoid()