tinvalidarrayaccess.nim 349 B

12345678910111213141516171819202122
  1. discard """
  2. errormsg: "index out of bounds: (a:0) <= (i:2) <= (b:1) "
  3. line: 18
  4. """
  5. block:
  6. try:
  7. let a = @[1,2]
  8. echo a[3]
  9. except Exception as e:
  10. doAssert e.msg == "index out of bounds: (i:3) <= (n:1) "
  11. block:
  12. type TTestArr = array[0..1, int16]
  13. var f: TTestArr
  14. f[0] = 30
  15. f[1] = 40
  16. f[2] = 50
  17. f[3] = 60
  18. echo(repr(f))