summary refs log blame commit diff stats
path: root/tests/async/tasync_in_seq_constr.nim
blob: 3d6dae2457bcf6b9596fda9b9ed809ec0f9cc6f5 (plain) (tree)
1
2
3
4
5
6
7
8
           



             

   
                      


                    


                                         

                                        





                                                            

                  
              
discard """
  output: '''
@[1, 2, 3, 4]
123
'''
"""

# bug #5314, bug #6626

import asyncdispatch

proc bar(i: int): Future[int] {.async.} =
    await sleepAsync(2)
    result = i

proc foo(): Future[seq[int]] {.async.} =
    await sleepAsync(2)
    result = @[1, 2, await bar(3), 4] # <--- The bug is here

proc foo2() {.async.} =
    await sleepAsync(2)
    echo(await bar(1), await bar(2), await bar(3))

echo waitFor foo()
waitFor foo2()