diff options
Diffstat (limited to 'tests/parallel/tsimple_array_checks.nim')
-rw-r--r-- | tests/parallel/tsimple_array_checks.nim | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/tests/parallel/tsimple_array_checks.nim b/tests/parallel/tsimple_array_checks.nim index 9874d3299..ab292f935 100644 --- a/tests/parallel/tsimple_array_checks.nim +++ b/tests/parallel/tsimple_array_checks.nim @@ -1,3 +1,25 @@ +discard """ +sortoutput: true +output: ''' +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +Hello 1 +Hello 2 +Hello 3 +Hello 4 +Hello 5 +Hello 6 +''' +""" + # bug #2287 import threadPool @@ -13,9 +35,9 @@ proc main = parallel: for n in nums: # Error: cannot prove: i <= len(nums) + -1 spawn log(n) - #for i in 0 .. <nums.len: # Error: cannot prove: i <= len(nums) + -1 + #for i in 0 ..< nums.len: # Error: cannot prove: i <= len(nums) + -1 #for i in 0 .. nums.len-1: # WORKS! - #for i in 0 .. <nums.len: # WORKS! + #for i in 0 ..< nums.len: # WORKS! # spawn log(nums[i]) # Array needs explicit size to work, probably related to issue #2287 @@ -37,5 +59,17 @@ proc maino = maino() # Doesn't work outside a proc -when isMainModule: +when true: main() + +block two: + proc f(a: openArray[int]) = + discard + + proc main() = + var a: array[0..9, int] = [0,1,2,3,4,5,6,7,8,9] + parallel: + spawn f(a[0..2]) + + + main() \ No newline at end of file |