mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +00:00
Change array.fetch_items/4 to return an empty list for an empty range in the
case where the endpoints of that range are not within the array bounds.
library/array.m:
As above.
deep_profiler/autopar_types.m:
Undo Zoltan's recent workaround for the above behaviour.
tests/hard_coded/array_fetch_items.{m,ex}:
Add tests for this behaviour.
41 lines
796 B
Plaintext
41 lines
796 B
Plaintext
================
|
|
Array = array([1, 2, 3, 4, 5])
|
|
Lo = 0
|
|
Hi = 4
|
|
List = [1, 2, 3, 4, 5]
|
|
================
|
|
Array = array([1, 2, 3, 4, 5])
|
|
Lo = 1
|
|
Hi = 3
|
|
List = [2, 3, 4]
|
|
================
|
|
Array = array([1, 2, 3, 4, 5])
|
|
Lo = 0
|
|
Hi = 0
|
|
List = [1]
|
|
================
|
|
Array = array([1, 2, 3, 4, 5])
|
|
Lo = -1
|
|
Hi = 0
|
|
EXCEPTION: "second argument of fetch_items: index -1 not in range [0, 4]"
|
|
================
|
|
Array = array([1, 2, 3, 4, 5])
|
|
Lo = 0
|
|
Hi = 6
|
|
EXCEPTION: "third argument of fetch_items: index 6 not in range [0, 4]"
|
|
================
|
|
Array = array([1, 2, 3, 4, 5])
|
|
Lo = 4
|
|
Hi = 2
|
|
List = []
|
|
================
|
|
Array = array([1, 2, 3, 4, 5])
|
|
Lo = 561
|
|
Hi = -1
|
|
List = []
|
|
================
|
|
Array = array([1, 2, 3, 4, 5])
|
|
Lo = 561
|
|
Hi = 561
|
|
EXCEPTION: "second argument of fetch_items: index 561 not in range [0, 4]"
|