File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 25542554 known-num-fields (:num-fields ctor-var)
25552555 argc (count args)]
25562556 (when (and (not (-> ctor meta :internal-ctor ))
2557- (some? known-num-fields) (not= known-num-fields argc))
2557+ (some? known-num-fields)
2558+ (not (or (= known-num-fields argc)
2559+ (and (:record ctor-var)
2560+ (= (+ 2 known-num-fields) argc)))))
25582561 (warning :fn-arity env {:argc argc :ctor ctor}))
25592562 {:env env :op :new :form form :class ctorexpr :args argexprs
25602563 :children [:class :args ]
Original file line number Diff line number Diff line change 14921492 '[(ns test.foo
14931493 (:import goog))]))
14941494 (is (= {} (get-in @cenv [::ana/namespaces 'test.foo :imports ])))))
1495+
1496+ (deftest test-cljs-3371
1497+ (let [ws (atom [])]
1498+ (ana/with-warning-handlers [(collecting-warning-handler ws)]
1499+ (env/with-compiler-env @test-cenv
1500+ (analyze (ana/empty-env )
1501+ '(do
1502+ (defrecord Foo [a])
1503+ (Foo. nil )
1504+ (Foo. nil nil nil )))))
1505+ (is (empty? @ws)))
1506+ (let [ws (atom [])]
1507+ (ana/with-warning-handlers [(collecting-warning-handler ws)]
1508+ (env/with-compiler-env @test-cenv
1509+ (analyze (ana/empty-env )
1510+ '(do
1511+ (defrecord Foo [a])
1512+ (Foo. nil nil )))))
1513+ (is (= 1 (count @ws)))
1514+ (is (string/starts-with? (first @ws) " Wrong number of args (2) passed to Foo" ))))
You can’t perform that action at this time.
0 commit comments