Skip to content

Commit

Permalink
get-in behaves incorrectly on values
Browse files Browse the repository at this point in the history
Values which don't satisfy `ILookup` are handled incorrectly.
  • Loading branch information
swannodette committed Jan 26, 2013
1 parent ad3ffec commit e8d2022
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cljs/cljs/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2737,10 +2737,12 @@ reduces them without incurring seq initialization"
m m
ks (seq ks)]
(if ks
(let [m (get m (first ks) sentinel)]
(if (identical? sentinel m)
not-found
(recur sentinel m (next ks))))
(if (not (satisfies? ILookup m))
not-found
(let [m (get m (first ks) sentinel)]
(if (identical? sentinel m)
not-found
(recur sentinel m (next ks)))))
m))))

(defn assoc-in
Expand Down
5 changes: 5 additions & 0 deletions test/cljs/cljs/core_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1797,5 +1797,10 @@
(assert (= (assoc {} 154618822656 1 261993005056 1)
{154618822656 1 261993005056 1}))

;; CLJS-458

(assert (= (get-in {:a {:b 1}} [:a :b :c] :nothing-there)
:nothing-there))

:ok
)

0 comments on commit e8d2022

Please sign in to comment.