<< Back to previous view

[CLJ-1364] Primitive VecSeq does not implement equals or hashing methods Created: 19/Feb/14  Updated: 02/Aug/15

Status: Open
Project: Clojure
Component/s: None
Affects Version/s: Release 1.5
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Alex Miller Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: collections

Approval: Triaged


VecSeq (as produced by (seq (vector-of :int 1 2 3))) does not implements equals, hashCode, or hasheq and does not play with any other Clojure collections or sequences appropriately in this regard.

user=> (def rs (range 3))
user=> (def vs (seq (vector-of :int 0 1 2)))
user=> rs
(0 1 2)
user=> vs
(0 1 2)
user=> (.equals rs vs)
user=> (.equals vs rs)    ;; expect: true
user=> (.equiv rs vs)
user=> (.equiv vs rs)
user=> (.hashCode rs)
user=> (.hashCode vs)     ;; expect to match (.hashCode rs)
user=> (System/identityHashCode vs)  ;; show that we're just getting Object hashCode
user=> (.hasheq rs)
user=> (.hasheq vs)       ;; expect same as (.hasheq rs) but not implemented at all
IllegalArgumentException No matching field found: hasheq for class clojure.core.VecSeq  clojure.lang.Reflector.getInstanceField (Reflector.java:271)

Generated at Tue Sep 01 19:27:35 CDT 2015 using JIRA 4.4#649-r158309.