[Chapel Merge] Fix comparisons for array fields

Branch: refs/heads/master
Revision: d164e9c
Author: bradcray
Log Message:

Merge pull request #16824 from bradcray/fix-comparisons-for-array-fields

Fix comparisons for array fields

[reviewed by @e-kayrakli]

Currently, compiler-generated comparisons (==, !=, etc.) for records containing array fields result in compile-time accesses to freed memory. This PR attempts to improve the situation by:

  • for compiler-generated == and != operators on records, implementing a helper function, chpl_field_neq, with array and non-array overloads, where the array overloads apply a reduction to the promoted != operator and the non-array cases just call !=
  • for compiler-generated <, <=, >, and >=, implementing helpers chpl_field_lt and chpl_field_gt which generate compiler errors saying that array fields don't support ordered comparisons by default, and calling the normal operators for traditional fields.

Beyond this, I:

  • retired the futures related to #7615.
  • added a new test for the ordered comparison cases
  • added the test case from #11487

This PR also contains a reasonably inconsequential (and ultimately desirable) change to DefaultSparse.chpl that I'd been carrying around in my repo and committed accidentally. I can pull it out of this PR if people prefer (though eventually, I think it belongs on master).

Resolves #7615.
Resolves #11487.
Resolves #16821

Modified Files:
A test/associative/types/testRecordArrayField.chpl

A test/associative/types/testRecordArrayField.good
A test/types/records/comparisons/compareRecords-gt.good
A test/types/records/comparisons/compareRecords-gte.good
A test/types/records/comparisons/compareRecords-lt.good
A test/types/records/comparisons/compareRecords-lte.good
A test/types/records/comparisons/compareRecords.chpl
A test/types/records/comparisons/compareRecords.compopts
R test/types/records/bharshbarger/recordArrCmp.bad
R test/types/records/bharshbarger/recordArrCmp.compopts
R test/types/records/bharshbarger/recordArrCmp.future
R test/types/records/bharshbarger/recordDomArrCmp.compopts
R test/types/records/bharshbarger/recordDomArrCmp.future
M compiler/passes/buildDefaultFunctions.cpp
M modules/internal/ChapelBase.chpl
M modules/internal/DefaultSparse.chpl

Compare: https://github.com/chapel-lang/chapel/compare/b596a4a3414a...d164e9cde7b5