* Make index out of bounds more useful by including the 'bounds'.
* fixes #9880 index out of bounds (remaining cases); revives #10228
* change err msg to: `index 3 not in 0 .. 1`
This commit is contained in:
Timothee Cour 2019-02-10 13:07:11 -08:00 • committed by Andreas Rumpf
commit 942495611b
11 changed files with 88 additions and 36 deletions

View file

@ -1,7 +1,7 @@
# imported by other modules, unlike helpers.nim which is included
template formatErrorIndexBound*[T](i, a, b: T): string =
"index out of bounds: (a: " & $a & ") <= (i: " & $i & ") <= (b: " & $b & ") "
"index " & $i & " not in " & $a & " .. " & $b
template formatErrorIndexBound*[T](i, n: T): string =
"index out of bounds: (i: " & $i & ") <= (n: " & $n & ") "
formatErrorIndexBound(i, 0, n)