tnon_disjoint_slice1.nim 454 B

123456789101112131415161718192021222324252627
  1. discard """
  2. matrix: "--mm:refc"
  3. errormsg: "cannot prove (i)..(i) disjoint from (i + 1)..(i + 1)"
  4. line: 21
  5. """
  6. import threadpool
  7. proc f(a: openArray[int]) =
  8. for x in a: echo x
  9. proc f(a: int) = echo a
  10. proc main() =
  11. var a: array[0..30, int]
  12. parallel:
  13. #spawn f(a[0..15])
  14. #spawn f(a[16..30])
  15. var i = 0
  16. while i <= 29:
  17. spawn f(a[i])
  18. spawn f(a[i+1])
  19. inc i
  20. #inc i # inc i, 2 would be correct here
  21. main()