tbasic_array_index.nim 990 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. discard """
  2. nimout: '''tbasic_array_index.nim(26, 17) Warning: cannot prove: 0 <= len(a) - 4; counter example: a.len -> 0 [IndexCheck]
  3. tbasic_array_index.nim(32, 5) Warning: cannot prove: 4.0 <= 1.0 [IndexCheck]
  4. tbasic_array_index.nim(38, 36) Warning: cannot prove: a <= 10'u32; counter example: a -> #x000000000000000b
  5. '''
  6. cmd: "drnim $file"
  7. action: "compile"
  8. """
  9. {.push staticBoundChecks: defined(nimDrNim).}
  10. proc takeNat(n: Natural) =
  11. discard
  12. proc p(a, b: openArray[int]) =
  13. if a.len > 0:
  14. echo a[0]
  15. for i in 0..a.len-8:
  16. #{.invariant: i < a.len.}
  17. echo a[i]
  18. for i in 0..min(a.len, b.len)-1:
  19. echo a[i], " ", b[i]
  20. takeNat(a.len - 4)
  21. proc r(x: range[0.0..1.0]) = echo x
  22. proc sum() =
  23. r 1.0
  24. r 4.0
  25. proc ru(x: range[1u32..10u32]) = echo x
  26. proc xu(a: uint) =
  27. if a >= 4u:
  28. let chunk = range[1u32..10u32](a)
  29. ru chunk
  30. proc parse(s: string) =
  31. var i = 0
  32. while i < s.len and s[i] != 'a':
  33. inc i
  34. parse("abc")
  35. {.pop.}
  36. p([1, 2, 3], [4, 5])