[Chapel Merge] Report an error for first/last on empty sparse dom

Branch: refs/heads/main
Revision: 5ba2f7c
Author: vasslitvinov
Link: Report an error for first/last on empty sparse domains by vasslitvinov · Pull Request #19057 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #19057 from vasslitvinov/sparse-first-last-err

Report an error for first/last on empty sparse domains

Currently spec leaves the behavior of .first / .last
on empty domains unspecified. Such queries on non-sparse
rectangular domains return low/high, whereas on sparse domains
they produce an "array index out of bounds" error, noting that
"index was 1 but array bounds are 1..0".

Switch the latter behavior to an error message that indicates directly
that first/last is invoked on an empty domain.

r: @lydia-duncan

Modified Files:
A test/sparse/domains/emptyFirst.chpl

A test/sparse/domains/emptyFirst.compopts
A test/sparse/domains/emptyFirst.good
A test/sparse/domains/emptyLast.chpl
A test/sparse/domains/emptyLast.compopts
A test/sparse/domains/emptyLast.good
M modules/internal/DefaultSparse.chpl

Compare: https://github.com/chapel-lang/chapel/compare/c28d63676ffe...5ba2f7c2f07c