Permalink
Browse files

CLJS-648: persistent assoc/conj on a transient-created collision node

Port of Christophe Grand's patch to Clojure (CLJ-1285).
  • Loading branch information...
1 parent c135f06 commit 2776c52fddbc2538d9d579df402670bd5b8f152e @michalmarczyk michalmarczyk committed with swannodette Oct 30, 2013
Showing with 8 additions and 1 deletion.
  1. +1 −1 src/cljs/cljs/core.cljs
  2. +7 −0 test/cljs/cljs/core_test.cljs
@@ -4693,7 +4693,7 @@ reduces them without incurring seq initialization"
(if (== hash collision-hash)
(let [idx (hash-collision-node-find-index arr cnt key)]
(if (== idx -1)
- (let [len (alength arr)
+ (let [len (* 2 cnt)
new-arr (make-array (+ len 2))]
(array-copy arr 0 new-arr 0 len)
(aset new-arr len key)
@@ -1980,5 +1980,12 @@
(assert (= (:a (KeywordTest.)) :nothing))
+ ;; CLJS-648 (CLJ-1285)
+ (let [a (reify IHash (-hash [_] 42))
+ b (reify IHash (-hash [_] 42))
+ s (set (range 128))]
+ (assert (= (-> (conj s a b) transient (disj! a) persistent! (conj a))
+ (-> (conj s a b) transient (disj! a) persistent! (conj a)))))
+
:ok
)

0 comments on commit 2776c52

Please sign in to comment.