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 2554
2554
known-num-fields (:num-fields ctor-var)
2555
2555
argc (count args)]
2556
2556
(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)))))
2558
2561
(warning :fn-arity env {:argc argc :ctor ctor}))
2559
2562
{:env env :op :new :form form :class ctorexpr :args argexprs
2560
2563
:children [:class :args ]
Original file line number Diff line number Diff line change 1492
1492
'[(ns test.foo
1493
1493
(:import goog))]))
1494
1494
(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