Skip to content

Commit

Permalink
fixes #22852; real bugfix is tied to bug #22672 (#23013)
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq authored Nov 30, 2023
1 parent 7ea5aaa commit ab7faa7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/system/indices.nim
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ proc `[]`*[Idx, T; U, V: Ordinal](a: array[Idx, T], x: HSlice[U, V]): seq[T] {.s
## ```
let xa = a ^^ x.a
let L = (a ^^ x.b) - xa + 1
result = newSeq[T](L)
# Workaround bug #22852:
result = newSeq[T](if L < 0: 0 else: L)
for i in 0..<L: result[i] = a[Idx(i + xa)]
# Workaround bug #22852
discard Natural(L)

proc `[]=`*[Idx, T; U, V: Ordinal](a: var array[Idx, T], x: HSlice[U, V], b: openArray[T]) {.systemRaisesDefect.} =
## Slice assignment for arrays.
Expand Down

0 comments on commit ab7faa7

Please sign in to comment.