[CLJ-1070] PersistentQueue's hash function does not match its equality Created: 15/Sep/12 Updated: 20/Oct/12 Resolved: 20/Oct/12
|Affects Version/s:||Release 1.4|
|Fix Version/s:||Release 1.5|
|Reporter:||Philip Potter||Assignee:||Philip Potter|
|Attachments:||001-fix-PersistentQueue-hash.clj 001-make-PersistentQueue-hash-match-equiv.diff 002-make-PersistentQueue-hash-match-equiv.diff|
|Patch:||Code and Test|
There are two issues:
1) PersistentQueue's hash function doesn't match its equiv function:
(def iq (conj clojure.lang.PersistentQueue/EMPTY (Integer. -1)))
2) PersistentQueue's hash function doesn't match PersistentVector's hash:
(def q (conj clojure.lang.PersistentQueue/EMPTY 1 2 3))
|Comment by Philip Potter [ 15/Sep/12 1:52 PM ]|
Clojure-dev discussion: https://groups.google.com/d/topic/clojure-dev/ME3-Ke-RbNk/discussion
|Comment by Philip Potter [ 15/Sep/12 2:34 PM ]|
Attached patch 001-make-PersistentQueue-hash-match-equiv.diff, 15/Sep/12.
|Comment by Philip Potter [ 15/Sep/12 4:56 PM ]|
Attached 002-make-PersistentQueue-hash-match-equiv.diff, 15/Sep/12. This patch supercedes 001-make-PersistentQueue-hash-match-equiv.diff.
Replaced test code which calls to Util/hasheq with code which calls hash instead.
|Comment by Chouser [ 18/Sep/12 1:38 AM ]|
Thanks for the patch, Philip, it looks good to me.
It really is a pity the implementations of hashCode and hasheq are duplicated. I wonder how important it is to extend Obj? Regardless, that's the approach PersistentQueue was already taking, so changing that would be outside the scope of this ticket anyway.
I can't apply this patch with "git am", but "patch -p 1" works fine. I'm hoping this is a configuration problem on my end, so I'm marking this screened.