Skip to content

Commit 4120781

Browse files
committed
CLJS-1212: Error in set ctor for > 8-entry map literal
Not all seq returning types return INext
1 parent 7f468d0 commit 4120781

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/cljs/cljs/core.cljs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7898,19 +7898,19 @@ reduces them without incurring seq initialization"
78987898
(defn set
78997899
"Returns a set of the distinct elements of coll."
79007900
[coll]
7901-
(let [^not-native in (seq coll)]
7901+
(let [in (seq coll)]
79027902
(cond
79037903
(nil? in) #{}
79047904

79057905
(and (instance? IndexedSeq in) (zero? (.-i in)))
79067906
(set-from-indexed-seq in)
79077907

79087908
:else
7909-
(loop [in in
7910-
^not-native out (-as-transient #{})]
7909+
(loop [^not-native in in
7910+
^not-native out (-as-transient #{})]
79117911
(if-not (nil? in)
7912-
(recur (-next in) (-conj! out (-first in)))
7913-
(-persistent! out))))))
7912+
(recur (next in) (-conj! out (-first in)))
7913+
(persistent! out))))))
79147914

79157915
(defn hash-set
79167916
"Returns a new hash set with supplied keys. Any equal keys are

test/cljs/cljs/core_test.cljs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2779,6 +2779,10 @@
27792779
(is (= (.getBasis TypeBasis) '[a b]))
27802780
(is (= (.getBasis RecordBasis) '[c d e])))
27812781

2782+
(deftest test-1212
2783+
(is (= (set {:a 0 :b 0 :c 0 :d 0 :e 0 :f 0 :g 0 :h 0 :i 0})
2784+
#{[:a 0] [:b 0] [:c 0] [:d 0] [:e 0] [:f 0] [:g 0] [:h 0] [:i 0]})))
2785+
27822786
(comment
27832787
;; ObjMap
27842788
;; (let [ks (map (partial str "foo") (range 500))

0 commit comments

Comments
 (0)