File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 906
906
(emitln " return " n " .call(this" (if (zero? pcnt) nil
907
907
(list " ," (comma-sep (take pcnt maxparams)))) " );" ))))
908
908
(emitln " }" )
909
- (emitln " throw(new Error('Invalid arity: ' + (arguments.length - 1)));" )
909
+ (let [arg-count-js (if (= 'self__ (-> ms first val :params first :name ))
910
+ " (arguments.length - 1)"
911
+ " arguments.length" )]
912
+ (emitln " throw(new Error('Invalid arity: ' + " arg-count-js " ));" ))
910
913
(emitln " };" )
911
914
(when variadic
912
915
(emitln mname " .cljs$lang$maxFixedArity = " max-fixed-arity " ;" )
Original file line number Diff line number Diff line change 1537
1537
; ; Make sure we didn't delete the alpha? fn
1538
1538
(is (some? alpha-2585?)))
1539
1539
1540
+ (defn fn-2741* ([x]) ([x y]))
1541
+ (def fn-2741 fn-2741* )
1542
+
1543
+ (deftest test-cljs-2741
1544
+ (is (thrown-with-msg? js/Error #".*Invalid arity: 0" ((fn ([x]) ([x y])))))
1545
+ (is (thrown-with-msg? js/Error #".*Invalid arity: 3" ((fn ([x]) ([x y])) 1 2 3 )))
1546
+ (is (thrown-with-msg? js/Error #".*Invalid arity: 0" (fn-2741 )))
1547
+ (is (thrown-with-msg? js/Error #".*Invalid arity: 3" (fn-2741 1 2 3 )))
1548
+ (is (thrown-with-msg? js/Error #".*Invalid arity: 0" ({})))
1549
+ (is (thrown-with-msg? js/Error #".*Invalid arity: 3" ({} 1 2 3 ))))
1550
+
1540
1551
(comment
1541
1552
; ; ObjMap
1542
1553
; ; (let [ks (map (partial str "foo") (range 500))
You can’t perform that action at this time.
0 commit comments