Skip to content

Commit 93c795f

Browse files
kotarakstuarthalloway
authored andcommitted
Do not check for duplicates in destructuring map creation
Signed-off-by: Stuart Halloway <[email protected]>
1 parent f75d47e commit 93c795f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/clj/clojure/core.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3932,7 +3932,7 @@
39323932
(let [gmap (gensym "map__")
39333933
defaults (:or b)]
39343934
(loop [ret (-> bvec (conj gmap) (conj v)
3935-
(conj gmap) (conj `(if (seq? ~gmap) (apply hash-map ~gmap) ~gmap))
3935+
(conj gmap) (conj `(if (seq? ~gmap) (clojure.lang.PersistentHashMap/create ~gmap) ~gmap))
39363936
((fn [ret]
39373937
(if (:as b)
39383938
(conj ret (:as b) gmap)

test/clojure/test_clojure/special.clj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@
2222
; var
2323
; fn
2424

25+
(deftest multiple-keys-in-destructuring
26+
(let [foo (fn [& {:keys [x]}] x)
27+
bar (fn [& options] (apply foo :x :b options))]
28+
(is (= (bar) :b))
29+
(is (= (bar :x :a) :a))))

0 commit comments

Comments
 (0)