Skip to content

Commit c86fdfa

Browse files
authored
add testcase for #9466 (#17538)
1 parent 6a355a4 commit c86fdfa

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/notnil/tnotnil5.nim

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
discard """
2+
matrix: "--threads:on"
3+
"""
4+
5+
{.experimental: "parallel".}
6+
{.experimental: "notnil".}
7+
import threadpool
8+
9+
type
10+
AO = object
11+
x: int
12+
13+
A = ref AO not nil
14+
15+
proc process(a: A): A =
16+
return A(x: a.x+1)
17+
18+
proc processMany(ayys: openArray[A]): seq[A] =
19+
var newAs: seq[FlowVar[A]]
20+
21+
parallel:
22+
for a in ayys:
23+
newAs.add(spawn process(a))
24+
for newAflow in newAs:
25+
let newA = ^newAflow
26+
if isNil(newA):
27+
return @[]
28+
result.add(newA)

0 commit comments

Comments
 (0)