Bob Nystrom
9d2b4af508
fix: allow empty ranges at the end of a sequence for lists and strings
...
Previously, empty ranges were only permitted at index zero on an empty sequence.
This change extends the `calculateRange` function to allow empty ranges at the
end of a non-empty sequence, enabling `list[3...3]` and `list[3..-1]` to return
an empty slice. Updated the range validation logic to check `range->from == *length`
instead of requiring a zero-length sequence, and added test cases for both lists
and strings to verify the new behavior.
2015-12-06 18:37:58 +00:00
..
2015-09-15 14:46:09 +00:00
2015-09-15 14:46:09 +00:00
2015-09-15 14:46:09 +00:00
2015-09-15 14:46:09 +00:00
2015-09-15 14:46:09 +00:00
2015-03-14 13:17:21 +00:00
2015-09-15 14:46:09 +00:00
2015-09-15 14:46:09 +00:00
2015-09-15 14:46:09 +00:00
2015-03-28 19:35:20 +00:00
2015-09-15 14:46:09 +00:00
2015-03-15 21:51:24 +00:00
2015-03-15 21:51:24 +00:00
2015-03-15 21:51:24 +00:00
2015-03-15 21:51:24 +00:00
2015-09-15 14:46:09 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-09-15 14:46:09 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-09-15 14:46:09 +00:00
2015-03-14 19:45:56 +00:00
2015-09-16 14:15:48 +00:00
2015-09-15 14:46:09 +00:00
2015-09-15 14:46:09 +00:00
2015-09-15 14:46:09 +00:00
2015-09-15 14:46:09 +00:00
2015-03-14 19:45:56 +00:00
2015-09-15 14:46:09 +00:00
2015-03-14 19:45:56 +00:00
2015-09-15 14:46:09 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-09-15 14:46:09 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-12-06 18:37:58 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-09-15 14:46:09 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-03-14 19:45:56 +00:00
2015-09-15 14:46:09 +00:00
2015-09-15 14:46:09 +00:00
2015-09-15 14:46:09 +00:00
2015-09-15 14:46:09 +00:00