diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-10-24 11:13:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-24 05:13:14 +0200 |
commit | 3fd4e684331a22be84e940833faee111226945ea (patch) | |
tree | 5d73452390185a94aa0c3f15f1be3f20fecd052f /lib | |
parent | 3095048d674b0cc17dfbf221f81e13a1dc1eb6c0 (diff) | |
download | Nim-3fd4e684331a22be84e940833faee111226945ea.tar.gz |
fixes #22856; enables `-d:nimStrictDelete` (#22858)
fixes #22856 `-d:nimStrictDelete` is introduced in 1.6.0, which promised to be enabled in the coming versions. To keep backwards incompatibilities, it also extends the feature of `-d:nimAuditDelete`, which now mimics the old behaviors.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system.nim | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/system.nim b/lib/system.nim index 1d81c3f22..41c9e96ea 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1986,10 +1986,6 @@ proc delete*[T](x: var seq[T], i: Natural) {.noSideEffect, systemRaisesDefect, a ## ## This is an `O(n)` operation. ## - ## .. note:: With `-d:nimStrictDelete`, an index error is produced when the index passed - ## to it was out of bounds. `-d:nimStrictDelete` will become the default - ## in upcoming versions. - ## ## See also: ## * `del <#del,seq[T],Natural>`_ for O(1) operation ## @@ -1998,7 +1994,7 @@ proc delete*[T](x: var seq[T], i: Natural) {.noSideEffect, systemRaisesDefect, a s.delete(2) doAssert s == @[1, 2, 4, 5] - when defined(nimStrictDelete): + when not defined(nimAuditDelete): if i > high(x): # xxx this should call `raiseIndexError2(i, high(x))` after some refactoring raise (ref IndexDefect)(msg: "index out of bounds: '" & $i & "' < '" & $x.len & "' failed") |