diff options
author | flywind <xzsflywind@gmail.com> | 2021-04-01 02:54:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-31 20:54:36 +0200 |
commit | 3f9c26539de010eaa12a879154f60e4bf656e6e3 (patch) | |
tree | 3b4e2ba5e537c654e0809492ade30a3e125af97a | |
parent | 9b67e5c61b50424e66b2a9bc8cc566058c71a223 (diff) | |
download | Nim-3f9c26539de010eaa12a879154f60e4bf656e6e3.tar.gz |
close #16786 (#17598)
-rw-r--r-- | tests/async/tasyncintemplate.nim | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/async/tasyncintemplate.nim b/tests/async/tasyncintemplate.nim index 31f4cd95c..0f810b5be 100644 --- a/tests/async/tasyncintemplate.nim +++ b/tests/async/tasyncintemplate.nim @@ -1,12 +1,46 @@ discard """ - output: 42 + output: ''' +42 +1 +2 +3 +4 +''' """ import asyncdispatch +# bug #16159 template foo() = proc temp(): Future[int] {.async.} = return 42 proc tempVoid(): Future[void] {.async.} = echo await temp() foo() waitFor tempVoid() + + +block: # bug #16786 + block: + proc main(a: int|string)= + proc bar(b: int|string) = echo b + bar(a) + main(1) + + block: + proc main(a: int) : Future[void] {.async.} = + proc bar(b: int): Future[void] {.async.} = echo b + await bar(a) + waitFor main(2) + + block: + proc main(a: int) : Future[void] {.async.} = + proc bar(b: int | string): Future[void] {.async.} = echo b + await bar(a) + waitFor main(3) + + block: + # bug + proc main(a: int|string) = + proc bar(b: int): Future[void] {.async.} = echo b + waitFor bar(a) + main(4) |