File tree 2 files changed +29
-3
lines changed
2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 2146
2146
(fn ~method))))]
2147
2147
(core/let [rname (symbol (core/str ana/*cljs-ns*) (core/str name))
2148
2148
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 )]))
2152
2156
meta (assoc meta
2153
2157
:top-fn
2154
2158
{:variadic variadic
2181
2185
(pp/pprint (multi-arity-fn 'foo {} '(([a]) ([a b]))))
2182
2186
(pp/pprint (multi-arity-fn 'foo {} '(([a]) ([a & xs]))))
2183
2187
(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]))))
2184
2190
)
2185
2191
2186
2192
(def
Original file line number Diff line number Diff line change 2751
2751
(testing " array-map should skip dropped elements of IndexedSeq"
2752
2752
(is (= {:a 1 } (apply array-map (drop 1 [0 :a 1 ]))))))
2753
2753
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
+
2754
2774
(comment
2755
2775
; ; ObjMap
2756
2776
; ; (let [ks (map (partial str "foo") (range 500))
You can’t perform that action at this time.
0 commit comments