Skip to content

Commit

Permalink
Add two futures for issues I encountered with arrays of ranges (#26619)
Browse files Browse the repository at this point in the history
[minor new tests, not reviewed]

One was while trying to sort the array, the other was trying to use it
in a zippered context

Relates to issue #26616 and #26618

Verified a fresh checkout of the futures
  • Loading branch information
lydia-duncan authored Jan 29, 2025
2 parents 49651a3 + b83a21f commit 28c09c7
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/library/standard/Sort/correctness/arrayOfRanges.bad
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 10 additions & 0 deletions test/library/standard/Sort/correctness/arrayOfRanges.chpl
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 2 additions & 0 deletions test/library/standard/Sort/correctness/arrayOfRanges.future
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
unimplemented feature: sorting arrays of ranges
#26616
1 change: 1 addition & 0 deletions test/library/standard/Sort/correctness/arrayOfRanges.good
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-1..0 1..2 3..4 5..5 6..7
3 changes: 3 additions & 0 deletions test/library/standard/Sort/correctness/arrayOfRanges.prediff
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

$CHPL_HOME/util/test/prediff-obscure-module-linenos $@
1 change: 1 addition & 0 deletions test/types/range/arrayOfRanges.bad
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
arrayOfRanges.chpl:10: error: Heterogeneous tuples don't support this style of loop yet
19 changes: 19 additions & 0 deletions test/types/range/arrayOfRanges.chpl
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 2 additions & 0 deletions test/types/range/arrayOfRanges.future
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
unimplemented feature: zippering an array of ranges with something else
#26618
2 changes: 2 additions & 0 deletions test/types/range/arrayOfRanges.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1..2 3..4 6..7 5..5 -1..0
2 2 2 1 2

0 comments on commit 28c09c7

Please sign in to comment.