Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CLJS-435: Stack overflow error when adding large numerical keys to maps

IHash implementation for numbers now apply modulo MAX INT on the floor
of the number.
  • Loading branch information...
commit 61455e64f58a07706c9b5ecebc9247bf085f7df1 1 parent 19d265d
David Nolen authored
Showing with 6 additions and 1 deletion.
  1. +1 −1  src/cljs/cljs/core.cljs
  2. +5 −0 test/cljs/cljs/core_test.cljs
View
2  src/cljs/cljs/core.cljs
@@ -452,7 +452,7 @@
(-equiv [x o] (identical? x o))
IHash
- (-hash [o] o))
+ (-hash [o] (js-mod (.floor js/Math o) 2147483647)))
(extend-type boolean
IHash
View
5 test/cljs/cljs/core_test.cljs
@@ -1778,5 +1778,10 @@
(assert (instance? js/Error (ex-info "asdf" {:foo 1})))
(assert (not (instance? cljs.core.ExceptionInfo (js/Error.))))
+ ;; CLJS-435
+
+ (assert (= (assoc {} 154618822656 1 261993005056 1)
+ {154618822656 1 261993005056 1}))
+
:ok
)
Please sign in to comment.
Something went wrong with that request. Please try again.