Nim/tests/async/tasync_in_seq_constr.nim
2017-12-15 15:33:43 +01:00

18 lines
364 B
Nim

discard """
errormsg: "invalid control flow: 'yield' within a constructor"
line: 16
"""
# bug #5314, bug #6626
import asyncdispatch
proc bar(): Future[int] {.async.} =
await sleepAsync(500)
result = 3
proc foo(): Future[seq[int]] {.async.} =
await sleepAsync(500)
result = @[1, 2, await bar(), 4] # <--- The bug is here
echo waitFor foo()