Skip to content

Commit

Permalink
CLJS-3190: Double arity warning constructing directly-accessed record
Browse files Browse the repository at this point in the history
  • Loading branch information
mfikes committed Nov 18, 2019
1 parent 910fbe3 commit 6ed9492
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/clojure/cljs/analyzer.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -3681,7 +3681,7 @@
(== 1 (count args))
(record-with-field? (:tag (first argexprs)) (symbol (name f))))
(let [field-access-form (list* (symbol (str ".-" (name f))) args)]
(analyze env field-access-form))
(no-warn (analyze env field-access-form)))
{:env env :op :invoke :form form :fn fexpr :args argexprs
:children [:fn :args]})))))

Expand Down
11 changes: 11 additions & 0 deletions src/test/clojure/cljs/analyzer_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2110,3 +2110,14 @@
a
(recur b 1)))))))
'any)))

(deftest test-cljs-3190
(let [ws (atom [])]
(ana/with-warning-handlers [(collecting-warning-handler ws)]
(env/with-compiler-env @test-cenv
(analyze (ana/empty-env)
'(do
(defrecord Foo [a])
(:a (->Foo))))))
(is (= 1 (count @ws)))
(is (string/starts-with? (first @ws) "Wrong number of args (0) passed to cljs.user/->Foo"))))

0 comments on commit 6ed9492

Please sign in to comment.