[Chapel Merge] Enable hash-based collections of ranges/arrays; ba

Branch: refs/heads/main
Revision: cf84f12
Author: bradcray
Link: Enable hash-based collections of ranges/arrays; base hash errors on reflection by bradcray · Pull Request #19212 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #19212 from bradcray/assoc-domain-any-hash

Enable hash-based collections of ranges/arrays; base hash errors on reflection

[reviewed by @bmcdonald3]

Prior to this PR, our code explicitly checked for specific types to
see whether they were legal to hash or not. This was problematic
because some types that supported hashes (like arrays) still could
not be used in hashtable-based data structures, while others (like
records not supporting hash()) would pass through only to create
problems.

In this PR, the code is generalized to simply check for the presence
of a .hash() method, with the exception of domains which continue
to enjoy special-case behavior, primarily because of confusions that
can arise otherwise when accidentally creating a literal domain of
domains due to not understanding or misplacing curly brackets.

More specifically:

  • removed a block of special-case code in ChapelHashing.chpl,
    replacing it with a Reflection call, and another special-case error
    in modules/internal/DefaultAssociative.chpl
  • added special-case error messages into initialize-style routines
    for domain idxTypes in modules/internal/ChapelHashtable.chpl,
    modules/internal/ChapelDomain.chpl
  • added a new autoCopy() overload to modules/internal/ChapelArray.chpl
    contributed by @mppf that was required to avoid a compiler assertion
  • added some new tests:
    • one of associative arrays of associative arrays:
      • test/associative/array/assocArrOfAssocArr.*
    • a few to lock in domain error messages:
      • test/types/chplhashtable/assocOfDom*.*
      • test/types/chplhashtable/mapOfDom.*
      • test/types/chplhashtable/setOfDom.*
  • updated other tests:
    • retired a future of assoc-of-arrays that now works:

      • test/domains/sungeun/assoc/arrayIdxType.*
    • removed an error from and associative-of-ranges test that now "works":

      • test/associative/bharshbarg/domains/rangeBad.good
    • updated the error for trying to hash a record with no hash fn:

      • test/types/chplhashtable/noHashForRecordWithEq*.good
    • updated error messages for tests testing hashtables of domains:

      • test/domains/bradc/oldExtraCurlies*.good
      • test/domains/sungeun/assoc/assocDomainIdxType.bad
      • test/domains/sungeun/assoc/domainIdxType.bad
      • test/domains/vass/assoc-idxtype-error-1.good
    • updated the output of a somewhat wonky historical test:

      • test/domains/vass/assoc-idxtype-error-2.good

      Modified Files:
      A test/associative/array/assocArrOfAssocArr.chpl
      A test/associative/array/assocArrOfAssocArr.good
      A test/types/chplhashtable/assocOfDom.chpl
      A test/types/chplhashtable/assocOfDom.good
      A test/types/chplhashtable/assocOfDom2.chpl
      A test/types/chplhashtable/assocOfDom2.good
      A test/types/chplhashtable/mapOfDom.chpl
      A test/types/chplhashtable/mapOfDom.good
      A test/types/chplhashtable/setOfDom.chpl
      A test/types/chplhashtable/setOfDom.good
      R test/domains/sungeun/assoc/arrayIdxType.bad
      R test/domains/sungeun/assoc/arrayIdxType.future
      M modules/internal/ChapelArray.chpl
      M modules/internal/ChapelDomain.chpl
      M modules/internal/ChapelHashing.chpl
      M modules/internal/ChapelHashtable.chpl
      M modules/internal/DefaultAssociative.chpl
      M test/associative/bharshbarg/domains/rangeBad.good
      M test/domains/bradc/oldExtraCurlies.good
      M test/domains/bradc/oldExtraCurlies2.good
      M test/domains/sungeun/assoc/arrayIdxType.good
      M test/domains/sungeun/assoc/assocArrayIdxType.bad
      M test/domains/sungeun/assoc/assocDomainIdxType.bad
      M test/domains/sungeun/assoc/domainIdxType.bad
      M test/domains/vass/assoc-idxtype-error-1.good
      M test/domains/vass/assoc-idxtype-error-2.good
      M test/types/chplhashtable/noHashForRecordWithEq.good
      M test/types/chplhashtable/noHashForRecordWithEq2.good

      Compare: Comparing d6358666b465...cf84f12a60db · chapel-lang/chapel · GitHub