[Chapel Merge] Better error diagnostics for unsupported domain op

Branch: refs/heads/main
Revision: dc8b7e6
Author: vasslitvinov
Link: Better error diagnostics for unsupported domain operations by vasslitvinov · Pull Request #19070 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #19070 from vasslitvinov/domain-unimplemented-ops

Better error diagnostics for unsupported domain operations

This PR implements better compile-time error messages in cases
when a common domain operation is invoked on a domain that
does not support it. For example, when stride is invoked
on an associative domain, the compiler now reports
this domain type does not support stride.

The covered operations are:

low
high
stride
alignment
first
last
alignedLow
alignedHigh
parSafe
indexOrder
orderToIndex
bulkAdd
makeIndexBuffer

Operations that have already provided this kind of diagnostics
and so are not affected by this PR include:
stridable expand exterior interior translate

The implementation is based on adding "last resort" overloads
that generate compilerError. This way domain maps are free
to add implementations of these operations.

SOME RELEVANT TRIVIA

"Last resort" methods take precedence during resolution over
forwarded methods. Therefore this PR adds some method definitions
that do the forwarding "manually", esp. in ArrayViewRankChange.chpl
and ArrayViewReindex.chpl, to avoid the error-generating overloads.

Using the override keyword causes a compilation error when the names
of the formal(s) in the overriding method and the overridden method differ.
Therefore some methods that became overrides as a result of this PR
do not have the override annotation.

WHILE THERE

Remove some "The following procedure is effectively equivalent to"
comments as they are no longer helpful.

Improve _makeIndexTuple() to add specificity to the error message,
when it is generated upon operations like by and align.

Improve runtime error reporting in orderToIndex.

NEXT STEPS

It will be a usability improvement if the error message reports
the type mismatch between the available function and its callsite
in the case an operation is available on a given domain however it is
invoked with incorrect arguments. Currently the existing compiler machinery
that does such reporting in other cases "misfires" in the context
of this PR: the error message highlights a candidate function that is not
applicable because its where clause evaluates to false, rather than
the candidate that would apply except for the actual/formal type mismatch.
Example operations include bulkAdd and expand.

Enable testing for sparse subdomains of associative domains, see
dfltAssociativeSparseSub, once we implement such subdomains.

Enable the testing in notsupportedRectOps-ok.chpl for DistributedBase
and DistributedSubdomain once Block domains start supporting
some standard rectangular-domain operations like first.

r: @dlongnecke-cray - thank you!

Modified Files:
A test/domains/compilerErrors/illegal-rank.chpl

A test/domains/compilerErrors/illegal-rank.good
A test/domains/compilerErrors/illegal-step.chpl
A test/domains/compilerErrors/illegal-step.good
A test/domains/compilerErrors/notsupportedBulkAdd-DR.chpl
A test/domains/compilerErrors/notsupportedBulkAdd-DR.good
A test/domains/compilerErrors/notsupportedBulkAdd-assoc.chpl
A test/domains/compilerErrors/notsupportedBulkAdd-assoc.good
A test/domains/compilerErrors/notsupportedBulkAdd-ok.chpl
A test/domains/compilerErrors/notsupportedBulkAdd-ok.good
A test/domains/compilerErrors/notsupportedCommon.chpl
A test/domains/compilerErrors/notsupportedCommon.notest
A test/domains/compilerErrors/notsupportedIndexOrder-assoc.chpl
A test/domains/compilerErrors/notsupportedIndexOrder-assoc.good
A test/domains/compilerErrors/notsupportedIndexOrder-ok.chpl
A test/domains/compilerErrors/notsupportedIndexOrder-ok.good
A test/domains/compilerErrors/notsupportedIndexOrder-sparse.chpl
A test/domains/compilerErrors/notsupportedIndexOrder-sparse.good
A test/domains/compilerErrors/notsupportedMakeBuffer-DR.chpl
A test/domains/compilerErrors/notsupportedMakeBuffer-DR.good
A test/domains/compilerErrors/notsupportedMakeBuffer-ok.chpl
A test/domains/compilerErrors/notsupportedMakeBuffer-ok.good
A test/domains/compilerErrors/notsupportedOrderIndex-ok.chpl
A test/domains/compilerErrors/notsupportedOrderIndex-ok.good
A test/domains/compilerErrors/notsupportedParsafe-DR.chpl
A test/domains/compilerErrors/notsupportedParsafe-DR.good
A test/domains/compilerErrors/notsupportedParsafe-block.chpl
A test/domains/compilerErrors/notsupportedParsafe-block.good
A test/domains/compilerErrors/notsupportedParsafe-ok.chpl
A test/domains/compilerErrors/notsupportedParsafe-ok.good
A test/domains/compilerErrors/notsupportedParsafe-sparse.chpl
A test/domains/compilerErrors/notsupportedParsafe-sparse.good
A test/domains/compilerErrors/notsupportedRectOps-assoc.chpl
A test/domains/compilerErrors/notsupportedRectOps-assoc.good
A test/domains/compilerErrors/notsupportedRectOps-ok.chpl
A test/domains/compilerErrors/notsupportedRectOps-ok.good
A test/domains/compilerErrors/notsupportedStridable-assoc.chpl
A test/domains/compilerErrors/notsupportedStridable-assoc.good
A test/domains/compilerErrors/notsupportedStridable-ok.chpl
A test/domains/compilerErrors/notsupportedStridable-ok.good
A test/domains/compilerErrors/orderIndex-non-int.chpl
A test/domains/compilerErrors/orderIndex-non-int.good
A test/domains/userAPI/orderIndex-OOB.chpl
A test/domains/userAPI/orderIndex-OOB.good
A test/domains/userAPI/orderIndex-empty.chpl
A test/domains/userAPI/orderIndex-empty.good
M modules/dists/BlockCycDist.chpl
M modules/dists/BlockDist.chpl
M modules/dists/CyclicDist.chpl
M modules/dists/StencilDist.chpl
M modules/internal/ArrayViewRankChange.chpl
M modules/internal/ArrayViewReindex.chpl
M modules/internal/ChapelArray.chpl
M modules/internal/ChapelDistribution.chpl
M modules/internal/ChapelDomain.chpl
M modules/internal/ChapelRange.chpl
M test/distributions/dm/n.chpl
M test/distributions/ferguson/dist-assoc-bulkadd.bad
M test/studies/comd/elegant/arrayOfStructs/util/AccumStencilDist.chpl
M test/users/aroonsharma/CyclicZipOpt.chpl
M test/users/aroonsharma/MyBlockCyclic.chpl

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