tasync_in_seq_constr.nim 442 B

1234567891011121314151617181920212223242526
  1. discard """
  2. output: '''
  3. @[1, 2, 3, 4]
  4. 123
  5. '''
  6. """
  7. # bug #5314, bug #6626
  8. import asyncdispatch
  9. proc bar(i: int): Future[int] {.async.} =
  10. await sleepAsync(2)
  11. result = i
  12. proc foo(): Future[seq[int]] {.async.} =
  13. await sleepAsync(2)
  14. result = @[1, 2, await bar(3), 4] # <--- The bug is here
  15. proc foo2() {.async.} =
  16. await sleepAsync(2)
  17. echo(await bar(1), await bar(2), await bar(3))
  18. echo waitFor foo()
  19. waitFor foo2()