Skip to content

Commit 15f9bbe

Browse files
committed
CLJS-1524: Bad hashing for Cons
1 parent 1a054b3 commit 15f9bbe

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2880,7 +2880,7 @@ reduces them without incurring seq initialization"
28802880
(if (nil? rest) nil (seq rest)))
28812881

28822882
ICollection
2883-
(-conj [coll o] (Cons. nil o coll __hash))
2883+
(-conj [coll o] (Cons. nil o coll nil))
28842884

28852885
IEmptyableCollection
28862886
(-empty [coll] (with-meta (.-EMPTY List) meta))

src/test/cljs/cljs/core_test.cljs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,6 +2983,18 @@
29832983
IFooBar
29842984
(cljs.core-test/a-method [_] "foobar"))))))
29852985

2986+
(deftest test-cljs-1524
2987+
(let [x0 []
2988+
x1 (conj x0 1)
2989+
x2 (conj x1 2)
2990+
x3 (remove #{1} x2)
2991+
x4 (remove #{2} x3)
2992+
x5 (conj x4 3)
2993+
x6 (conj x5 4)
2994+
x7 (conj x6 5)]
2995+
(is (not (== (hash x0) (hash x1) (hash x2) (hash x3) (hash x4)
2996+
(hash x5) (hash x6) (hash x7))))))
2997+
29862998
(comment
29872999
;; ObjMap
29883000
;; (let [ks (map (partial str "foo") (range 500))

0 commit comments

Comments
 (0)