Files
Nim/tests/async/t15804.nim
Andreas Rumpf dfd8a83f35 fixes #15804 (#15820)
* fixes #15804

* fix the existing test

* add the testcase for #15804

Co-authored-by: narimiran <narimiran@disroot.org>
2020-11-02 14:17:09 +01:00

16 lines
305 B
Nim

import asyncdispatch
type
Foo*[E] = ref object
op: proc(): Future[bool] {.gcsafe.}
proc newFoo*[E](): Foo[E] =
result = Foo[E]()
result.op = proc(): Future[bool] {.gcsafe,async.} =
await sleepAsync(100)
result = false
when isMainModule:
let f = newFoo[int]()
echo waitFor f.op()