From 8904086264588cbb56431cb44428e863b20fab92 Mon Sep 17 00:00:00 2001 From: Lydia Duncan Date: Wed, 29 Jan 2025 10:29:45 -0800 Subject: [PATCH 1/2] Add two futures for issues I encountered with arrays of ranges One was while trying to sort the array, the other was trying to use it in a zippered context ---- Signed-off-by: Lydia Duncan --- .../Sort/correctness/arrayOfRanges.bad | 9 +++++++++ .../Sort/correctness/arrayOfRanges.chpl | 10 ++++++++++ .../Sort/correctness/arrayOfRanges.future | 2 ++ .../Sort/correctness/arrayOfRanges.good | 1 + .../Sort/correctness/arrayOfRanges.prediff | 3 +++ test/types/range/arrayOfRanges.bad | 1 + test/types/range/arrayOfRanges.chpl | 19 +++++++++++++++++++ test/types/range/arrayOfRanges.future | 2 ++ test/types/range/arrayOfRanges.good | 2 ++ 9 files changed, 49 insertions(+) create mode 100644 test/library/standard/Sort/correctness/arrayOfRanges.bad create mode 100644 test/library/standard/Sort/correctness/arrayOfRanges.chpl create mode 100644 test/library/standard/Sort/correctness/arrayOfRanges.future create mode 100644 test/library/standard/Sort/correctness/arrayOfRanges.good create mode 100755 test/library/standard/Sort/correctness/arrayOfRanges.prediff create mode 100644 test/types/range/arrayOfRanges.bad create mode 100644 test/types/range/arrayOfRanges.chpl create mode 100644 test/types/range/arrayOfRanges.future create mode 100644 test/types/range/arrayOfRanges.good diff --git a/test/library/standard/Sort/correctness/arrayOfRanges.bad b/test/library/standard/Sort/correctness/arrayOfRanges.bad new file mode 100644 index 000000000000..f089922d837d --- /dev/null +++ b/test/library/standard/Sort/correctness/arrayOfRanges.bad @@ -0,0 +1,9 @@ +$CHPL_HOME/modules/standard/Sort.chpl:nnnn: In function 'compareByPart': +$CHPL_HOME/modules/standard/Sort.chpl:nnnn: error: illegal tuple variable declaration with non-tuple initializer + $CHPL_HOME/modules/standard/Sort.chpl:nnnn: called as compareByPart(a: range(int(64),both,one), b: range(int(64),both,one), comparator: defaultComparator) + within internal functions (use --print-callstack-on-error to see) + $CHPL_HOME/modules/standard/Sort.chpl:nnnn: called as shellSortMoveElts(Data: [domain(1,int(64),one)] range(int(64),both,one), comparator: defaultComparator, start: int(64), end: int(64)) from function 'msbRadixSort' + $CHPL_HOME/modules/standard/Sort.chpl:nnnn: called as msbRadixSort(A: [domain(1,int(64),one)] range(int(64),both,one), start_n: int(64), end_n: int(64), criterion: defaultComparator, startbit: int(64), endbit: int(64), settings: MSBRadixSortSettings(5,false,false)) from function 'msbRadixSort' + $CHPL_HOME/modules/standard/Sort.chpl:nnnn: called as msbRadixSort(Data: [domain(1,int(64),one)] range(int(64),both,one), comparator: defaultComparator, region: range(int(64),both,one)) from function 'unstableSort' + $CHPL_HOME/modules/standard/Sort.chpl:nnnn: called as unstableSort(x: [domain(1,int(64),one)] range(int(64),both,one), comparator: defaultComparator, region: range(int(64),both,one)) from function 'sort' + arrayOfRanges.chpl:8: called as sort(x: [domain(1,int(64),one)] range(int(64),both,one), comparator: defaultComparator, param stable = false) diff --git a/test/library/standard/Sort/correctness/arrayOfRanges.chpl b/test/library/standard/Sort/correctness/arrayOfRanges.chpl new file mode 100644 index 000000000000..fd6a4ab69b86 --- /dev/null +++ b/test/library/standard/Sort/correctness/arrayOfRanges.chpl @@ -0,0 +1,10 @@ +// Motivated by wanting to sort the ranges returned by the range leader iterator +use Sort; + +var arr: [0..4] range = [1..2, 3..4, 6..7, 5..5, -1..0]; + +writeln(arr); + +sort(arr); + +writeln(arr); diff --git a/test/library/standard/Sort/correctness/arrayOfRanges.future b/test/library/standard/Sort/correctness/arrayOfRanges.future new file mode 100644 index 000000000000..ef8bcb195f7b --- /dev/null +++ b/test/library/standard/Sort/correctness/arrayOfRanges.future @@ -0,0 +1,2 @@ +unimplemented feature: sorting arrays of ranges +#26616 diff --git a/test/library/standard/Sort/correctness/arrayOfRanges.good b/test/library/standard/Sort/correctness/arrayOfRanges.good new file mode 100644 index 000000000000..cea047d2daaa --- /dev/null +++ b/test/library/standard/Sort/correctness/arrayOfRanges.good @@ -0,0 +1 @@ +-1..0 1..2 3..4 5..5 6..7 diff --git a/test/library/standard/Sort/correctness/arrayOfRanges.prediff b/test/library/standard/Sort/correctness/arrayOfRanges.prediff new file mode 100755 index 000000000000..523a8612ae47 --- /dev/null +++ b/test/library/standard/Sort/correctness/arrayOfRanges.prediff @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +$CHPL_HOME/util/test/prediff-obscure-module-linenos $@ diff --git a/test/types/range/arrayOfRanges.bad b/test/types/range/arrayOfRanges.bad new file mode 100644 index 000000000000..3a3316b51047 --- /dev/null +++ b/test/types/range/arrayOfRanges.bad @@ -0,0 +1 @@ +arrayOfRanges.chpl:10: error: Heterogeneous tuples don't support this style of loop yet diff --git a/test/types/range/arrayOfRanges.chpl b/test/types/range/arrayOfRanges.chpl new file mode 100644 index 000000000000..85606bf62d29 --- /dev/null +++ b/test/types/range/arrayOfRanges.chpl @@ -0,0 +1,19 @@ +// Motivated by getting the subranges from the range leader iterator +var arr: [0..4] range = [1..2, 3..4, 6..7, 5..5, -1..0]; + +writeln(arr); + +var arr2: [arr.domain] int; + +// I wanted to store the size of each of the ranges into a separate array, but +// writing it like this didn't work. +forall (i, r) in (arr.domain, arr) { + arr2[i] = r.size; +} +/* Had to use this instead: +for i in arr.domain { + arr2[i] = arr[i].size; +} +*/ + +writeln(arr2); diff --git a/test/types/range/arrayOfRanges.future b/test/types/range/arrayOfRanges.future new file mode 100644 index 000000000000..18ee88dbaed9 --- /dev/null +++ b/test/types/range/arrayOfRanges.future @@ -0,0 +1,2 @@ +unimplemented feature: zippering an array of ranges with something else +#26618 diff --git a/test/types/range/arrayOfRanges.good b/test/types/range/arrayOfRanges.good new file mode 100644 index 000000000000..475e49e522eb --- /dev/null +++ b/test/types/range/arrayOfRanges.good @@ -0,0 +1,2 @@ +1..2 3..4 6..7 5..5 -1..0 +2 2 2 1 0 From b83a21f9bb8da05db1594b82fcd055d53f9f786e Mon Sep 17 00:00:00 2001 From: Lydia Duncan Date: Wed, 29 Jan 2025 10:34:50 -0800 Subject: [PATCH 2/2] Fix .good for this test My brain didn't fully comprehend `-1..0` and substituted `1..0` from early work. Oops ---- Signed-off-by: Lydia Duncan --- test/types/range/arrayOfRanges.good | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/types/range/arrayOfRanges.good b/test/types/range/arrayOfRanges.good index 475e49e522eb..f4a444bd680e 100644 --- a/test/types/range/arrayOfRanges.good +++ b/test/types/range/arrayOfRanges.good @@ -1,2 +1,2 @@ 1..2 3..4 6..7 5..5 -1..0 -2 2 2 1 0 +2 2 2 1 2