Branch: refs/heads/main
Revision: dd4ad77
Author: bmcdonald3
Log Message:
Merge pull request #18343 from bmcdonald3/user-defined-hash
Allow overriding of hash function in records with a hash()
method
[reviewed by (and much help from) @mppf - Thanks!]
This PR renames chpl__defaultHash()
to hash()
and changes it to a method rather than a function. Users can create records that allow users to define type.hashThis()
in their record, and that will get used by the internal hash table (e.g., map, associative arrays, etc.).
- [x] standard paratest
- [x] testing added
Motivated by https://github.com/cray/chapel-private/issues/2365
Discussion issue: User-defined hash functions for Map · Issue #18291 · chapel-lang/chapel · GitHub
Modified Files:
A test/types/chplhashtable/defined-hash.chpl
A test/types/chplhashtable/defined-hash.good
A test/types/chplhashtable/user-hashing.chpl
A test/types/chplhashtable/user-hashing.good
M compiler/passes/buildDefaultFunctions.cpp
M compiler/resolution/tuples.cpp
M modules/internal/Bytes.chpl
M modules/internal/ChapelHashing.chpl
M modules/internal/ChapelHashtable.chpl
M modules/internal/String.chpl
M test/associative/ferguson/check-hashing-statistics.chpl
M test/associative/waynew/record_hash.chpl
M test/constrained-generics/hashtable/test-chpl-hashtable.chpl
M test/exercises/duplicates/forStudents/FileHashing.chpl
M test/library/standard/Set/setRecordEqualityOverload.chpl
M test/types/chplhashtable/test-chpl-hashtable.chpl
Compare: https://github.com/chapel-lang/chapel/compare/9f92608e097f...dd4ad77314bb