mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 01:44:37 +00:00
* fixes #15804 * fix the existing test * add the testcase for #15804 Co-authored-by: narimiran <narimiran@disroot.org>
16 lines
305 B
Nim
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()
|