File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 21462146 (fn ~method))))]
21472147 (core/let [rname (symbol (core/str ana/*cljs-ns*) (core/str name))
21482148 arglists (map first fdecl)
2149- variadic (boolean (some #(some '#{&} %) arglists))
2150- sigs (remove #(some '#{&} %) arglists)
2151- maxfa (apply core/max (map count sigs))
2149+ varsig? #(some '#{&} %)
2150+ variadic (boolean (some varsig? arglists))
2151+ sigs (remove varsig? arglists)
2152+ maxfa (apply core/max
2153+ (concat
2154+ (map count sigs)
2155+ [(core/- (count (first (filter varsig? arglists))) 2 )]))
21522156 meta (assoc meta
21532157 :top-fn
21542158 {:variadic variadic
21812185 (pp/pprint (multi-arity-fn 'foo {} '(([a]) ([a b]))))
21822186 (pp/pprint (multi-arity-fn 'foo {} '(([a]) ([a & xs]))))
21832187 (pp/pprint (multi-arity-fn 'foo {} '(([a]) ([a [b & cs] & xs]))))
2188+ ; ; CLJS-1216
2189+ (pp/pprint (multi-arity-fn 'foo {} '(([a]) ([a b & xs]))))
21842190 )
21852191
21862192(def
Original file line number Diff line number Diff line change 27512751 (testing " array-map should skip dropped elements of IndexedSeq"
27522752 (is (= {:a 1 } (apply array-map (drop 1 [0 :a 1 ]))))))
27532753
2754+ (defn foo-1216
2755+ ([a] (foo-1216 a 10 ))
2756+ ([a b & [c]] [a b c]))
2757+
2758+ (defn destructure-1216
2759+ ([kvs] kvs)
2760+ ([k v & args] [k v args]))
2761+
2762+ (deftest test-cljs-1216
2763+ (testing " varargs regression"
2764+ (is (= (foo-1216 1 ) [1 10 nil ]))
2765+ (is (= (foo-1216 1 2 ) [1 2 nil ]))
2766+ (is (= (foo-1216 1 2 3 ) [1 2 3 ]))
2767+ (is (= [1 2 [3 4 ]]
2768+ (destructure-1216 1 2 3 4 )))
2769+ (is (= [1 2 [3 4 ]]
2770+ (apply destructure-1216 [1 2 3 4 ])))
2771+ (is (= (destructure-1216 1 2 3 4 )[1 2 [3 4 ]]
2772+ (apply destructure-1216 [1 2 3 4 ])))))
2773+
27542774(comment
27552775 ; ; ObjMap
27562776 ; ; (let [ks (map (partial str "foo") (range 500))
You can’t perform that action at this time.
0 commit comments