Permalink
Browse files

`get-in` behaves incorrectly on values

Values which don't satisfy `ILookup` are handled incorrectly.
  • Loading branch information...
1 parent ad3ffec commit e8d20229ee87747e3012ac97b5b7006d3703a305 @swannodette swannodette committed Jan 26, 2013
Showing with 11 additions and 4 deletions.
  1. +6 −4 src/cljs/cljs/core.cljs
  2. +5 −0 test/cljs/cljs/core_test.cljs
View
@@ -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
@@ -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.