Branch: refs/heads/main
Revision: 8724f3e
Author: bradcray
Link: Fix some problems in sets / hash tables of arrays by bradcray · Pull Request #18640 · chapel-lang/chapel · GitHub
Log Message:
Merge pull request #18640 from bradcray/fix-set-of-arr
Fix some problems in sets / hash tables of arrays
[reviewed by @bmcdonald3, helped along by @mppf]
This fixes support for sets of arrays by fixing a ==
-based key comparison
and using an explicit new
call to create the underlying hash table rather
than relying on default initialization (contributed by @mppf).
Specifically, we were using key == key
to look for existing keys before, but
for an array type, this will generate an array of bools rather than a single bool
as we require here. So this PR pushes the test into a helper routine to compute
it, which is sufficient to get the setOfArray.chpl future working.
I then extended setOfArray.chpl to see if we could actually work with the set,
and it turned out that we couldn't due to #15929 until we applied the workaround
in that issue to ensure that the set's element type's runtime type was established
properly (thanks to @mppf).
While working on this, I added a pair of futures that demonstrate that a generic
record instantiated with an array doesn't work: genericRecordOfArray*.chpl
which seem related to:
- Problem with runtime type and default initialization · Issue #15929 · chapel-lang/chapel · GitHub
- Runtime type info of domains not initialized correctly when method has `in` intent · Issue #13808 · chapel-lang/chapel · GitHub and/or
-
handle record and class types with runtime types · Issue #11549 · chapel-lang/chapel · GitHub
but felt simpler than any futures I quickly found for those cases.
Resolves #16033.
Modified Files:
A test/types/records/generic/genericRecordOfArr.bad
A test/types/records/generic/genericRecordOfArr.chpl
A test/types/records/generic/genericRecordOfArr.future
A test/types/records/generic/genericRecordOfArr.good
A test/types/records/generic/genericRecordOfArr2.bad
A test/types/records/generic/genericRecordOfArr2.chpl
A test/types/records/generic/genericRecordOfArr2.future
A test/types/records/generic/genericRecordOfArr2.good
R test/library/standard/Set/setOfArray.future
M modules/internal/ChapelHashtable.chpl
M modules/standard/Set.chpl
M test/library/standard/Set/setOfArray.chpl
M test/library/standard/Set/setOfArray.good
Compare: https://github.com/chapel-lang/chapel/compare/0e2e59ada126...8724f3e3221b