summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorTanguy <tanguy@status.im>2022-06-15 16:38:12 +0200
committerGitHub <noreply@github.com>2022-06-15 16:38:12 +0200
commitd33e1127666be23ad2dc879c2f89a41c179e2093 (patch)
tree5e7977fe1ba6f15583e78bf487062442cba609f8 /lib
parente7e8f437c4f95f4f5d038cdddf5036462733288a (diff)
downloadNim-d33e1127666be23ad2dc879c2f89a41c179e2093.tar.gz
Better range error messages (#19867)
* Better range error messages

* Revert to old behavior for arrays

* Small corrections
Diffstat (limited to 'lib')
-rw-r--r--lib/system/chcks.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/system/chcks.nim b/lib/system/chcks.nim
index a404e9d40..1e1ce9c87 100644
--- a/lib/system/chcks.nim
+++ b/lib/system/chcks.nim
@@ -16,6 +16,9 @@ proc raiseRangeError(val: BiggestInt) {.compilerproc, noinline.} =
   else:
     sysFatal(RangeDefect, "value out of range: ", $val)
 
+proc raiseIndexError4(l1, h1, h2: int) {.compilerproc, noinline.} =
+  sysFatal(IndexDefect, "index out of bounds: " & $l1 & ".." & $h1 & " notin 0.." & $(h2 - 1))
+
 proc raiseIndexError3(i, a, b: int) {.compilerproc, noinline.} =
   sysFatal(IndexDefect, formatErrorIndexBound(i, a, b))