diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-04-14 12:22:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-14 21:22:22 +0200 |
commit | d6242d7fe19849d6cc7079f0b006065fb2a8a19e (patch) | |
tree | 3b6654d930d23e6e70ae2907e68503641ec738a1 /tests/async | |
parent | 56c37759d6183aa32d474e669de618ee9c4f7633 (diff) | |
download | Nim-d6242d7fe19849d6cc7079f0b006065fb2a8a19e.tar.gz |
simplify asyncfutures, asyncmacro (#17633)
Diffstat (limited to 'tests/async')
-rw-r--r-- | tests/async/tasyncintemplate.nim | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/tests/async/tasyncintemplate.nim b/tests/async/tasyncintemplate.nim index 0f810b5be..4bddb1d18 100644 --- a/tests/async/tasyncintemplate.nim +++ b/tests/async/tasyncintemplate.nim @@ -1,6 +1,8 @@ discard """ output: ''' 42 +43 +43 1 2 3 @@ -8,16 +10,30 @@ discard """ ''' """ +# xxx move to tests/async/tasyncintemplate.nim 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 #16159 + template foo() = + proc temp(): Future[int] {.async.} = return 42 + proc tempVoid(): Future[void] {.async.} = echo await temp() + foo() + waitFor tempVoid() + +block: # aliasing `void` + template foo() = + type Foo = void + proc temp(): Future[int] {.async.} = return 43 + proc tempVoid(): Future[Foo] {.async.} = echo await temp() + proc tempVoid2() {.async.} = echo await temp() + foo() + waitFor tempVoid() + waitFor tempVoid2() + +block: # sanity check + template foo() = + proc bad(): int {.async.} = discard + doAssert not compiles(bad()) block: # bug #16786 block: |