Skip to content

Fix hash consistency for content-equal collections - #1008

Open
sanketpatel32 wants to merge 2 commits into
JuliaCollections:masterfrom
sanketpatel32:devin/1795966473-hash-collections
Open

sanketpatel32 wants to merge 2 commits into
JuliaCollections:masterfrom
sanketpatel32:devin/1795966473-hash-collections

Conversation

@sanketpatel32

Copy link
Copy Markdown

Summary

  • Define Base.hash for Stack, Queue, MutableLinkedList, MultiDict, Nil/Cons, and SortedMultiDict so content-equal values hash consistently and can share Set/Dict slots.
  • Ordered containers hash their contents in order with per-type seeds; MultiDict delegates to its underlying Dict hash with a seed so key insertion order does not affect the result.
  • Nil hashes independently of its element type, and SortedMultiDict includes its ordering object and ordered key/value sequence.
  • Add regression coverage for the issue reproducer and for unequal values hashing differently.

Closes #998

Testing

  • Julia 1.13.4: julia --project -e 'using Pkg; Pkg.test()' — 290099/290099 tests passed
  • Julia 1.6.7: julia --project test/runtests.jl stack queue list mutable_list multi_dict sorted_containers — 3155/3155 tests passed

AI assistance

Implemented with assistance from Devin (claude opus 5.5).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hash disagrees with isequal for Stack, Queue, MutableLinkedList, MultiDict, LinkedList and SortedMultiDict

1 participant