summary refs log tree commit diff stats
path: root/tests/async/tasync_in_seq_constr.nim
blob: 3d6dae2457bcf6b9596fda9b9ed809ec0f9cc6f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()
812' href='/akkartik/mu/commit/html/console.mu.html?h=hlt&id=a654e4ecace2d506d1b10f1dde2c287ebe84ef37'>a654e4ec ^
dbe12410 ^
e5c11a51 ^
a654e4ec ^
204dae92 ^



97eb971b ^
204dae92 ^


9e751bb8 ^



204dae92 ^



dbe12410 ^


a654e4ec ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80