[Chapel Merge] Fix bug when calling localSlice() on slice-of-DR

Branch: refs/heads/main
Revision: d971b1c
Author: bradcray
Link: Fix bug when calling localSlice() on slice-of-DR by bradcray · Pull Request #19090 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #19090 from bradcray/fix-local-slice

Fix bug when calling localSlice() on slice-of-DR

[reviewed by @aconsroe-hpe]

In issue #19087, @jlbyrne-hpe pointed out that the localSlice() methods on slices
of DR arrays were not calling into the "simple, local" case, but rather trying to call
into the .dsiLocalSlice() method, which is not supported on DR arrays, resulting in
a fairly terrible error message. Though I didn't check, I'd guess that this is
because the .localSlice() logic pre-dated the support for array views and was not
updated once they were introduced.

Here, I changed to using the chpl__isDROrDRView utility query that we introduced
when adding array views and use heavily. That said, better would be to elevate this
to a user-facing interface as John requests in #19088, and then retire these other
ways of making the query from our internal modules as we find them.

In making this change, I looked for other places in this file that relied on a similar
isSubtype(_value.type, DefaultRectangularArr) check as the one that was failing
here, and didn't find any (though there may be other ways of making a similar query
that are similarly fragile to array views).

Added a test that expands on John's test case by testing multi-dimensional arrays
and slicing with both domains and arrays.

Resolves #19087

Modified Files:
A test/arrays/slices/localSliceDRSlice.chpl

A test/arrays/slices/localSliceDRSlice.good
M modules/internal/ChapelArray.chpl

Compare: https://github.com/chapel-lang/chapel/compare/6c236061d555...d971b1c9e59b