Skip to content
Permalink
Browse files

CLJS-3190: Double arity warning constructing directly-accessed record

  • Loading branch information
mfikes committed Nov 17, 2019
1 parent 910fbe3 commit 6ed949278ba61dceeafb709583415578b6f7649b
Showing with 12 additions and 1 deletion.
  1. +1 −1 src/main/clojure/cljs/analyzer.cljc
  2. +11 −0 src/test/clojure/cljs/analyzer_tests.clj
@@ -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]})))))

@@ -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.
You can’t perform that action at this time.