summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/pure/includes/asyncfutures.nim9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/pure/includes/asyncfutures.nim b/lib/pure/includes/asyncfutures.nim
index 029c5f157..c83228014 100644
--- a/lib/pure/includes/asyncfutures.nim
+++ b/lib/pure/includes/asyncfutures.nim
@@ -94,7 +94,7 @@ proc complete*(future: Future[void]) =
 
 proc complete*[T](future: FutureVar[T]) =
   ## Completes a ``FutureVar``.
-  template fut: expr = Future[T](future)
+  template fut: untyped = Future[T](future)
   checkFinished(fut)
   assert(fut.error == nil)
   fut.finished = true
@@ -105,7 +105,7 @@ proc complete*[T](future: FutureVar[T], val: T) =
   ## Completes a ``FutureVar`` with value ``val``.
   ##
   ## Any previously stored value will be overwritten.
-  template fut: expr = Future[T](future)
+  template fut: untyped = Future[T](future)
   checkFinished(fut)
   assert(fut.error == nil)
   fut.finished = true
@@ -199,7 +199,10 @@ proc finished*[T](future: Future[T] | FutureVar[T]): bool =
   ## Determines whether ``future`` has completed.
   ##
   ## ``True`` may indicate an error or a value. Use ``failed`` to distinguish.
-  (Future[T](future)).finished
+  when future is FutureVar[T]:
+    result = (Future[T](future)).finished
+  else:
+    result = future.finished
 
 proc failed*(future: FutureBase): bool =
   ## Determines whether ``future`` completed with an error.
ac0e9db5 ^
7be15b8b ^
5a702544 ^


795f5244 ^








91abd257 ^




795f5244 ^



f3760b0f ^







08cf048f ^






ac0e9db5 ^
b39ceb27 ^
d98e1a18 ^

b39ceb27 ^






f17b34a8 ^
b39ceb27 ^



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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141