Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: Release 1.4, Release 1.5
-
Fix Version/s: Release 1.5
-
Component/s: None
-
Labels:None
-
Patch:Code and Test
-
Approval:Ok
Description
Equality for sets is not consistent with other persistent collections when the hashCode differs:
(= {(Integer. -1) :foo} {(Long. -1) :foo})
=> true
(= [(Integer. -1)] [(Long. -1)])
=> true
(= #{(Integer. -1)} #{(Long. -1)})
=> false
Attached is what I believe to be a basic fix. It removes a hashCode check from APersistentSet.equals. A similar check was removed from APersistentMap in the following commit:
https://github.com/clojure/clojure/commit/b5f5ba2e15dc2f20e14e05141f7de7c6a3d91179
With this patch, set equality works as expected and all tests pass.
My understanding of the implications of this change are limited, so someone more knowledgeable would need to chime in about its correctness.
Any chance this will make 1.5?