Skip to content

Commit 85f348c

Browse files
author
dnolen
committed
CLJS-1970: Cannot infer target type for list/vector expressions
tag deftype/record symbol as function
1 parent 9b63f9a commit 85f348c

2 files changed

Lines changed: 13 additions & 16 deletions

File tree

src/main/clojure/cljs/analyzer.cljc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2802,6 +2802,7 @@
28022802
(fn [m]
28032803
(let [m (assoc (or m {})
28042804
:name t
2805+
:tag 'function
28052806
:type true
28062807
:num-fields (count fields)
28072808
:record (= :defrecord* op))]
@@ -2810,6 +2811,7 @@
28102811
{:protocols protocols}
28112812
(source-info tsym env)))))
28122813
{:op op :env env :form form :t t :fields fields :pmasks pmasks
2814+
:tag 'function
28132815
:protocols (disj protocols 'cljs.core/Object)
28142816
:body (analyze (assoc env :locals locals) body)}))
28152817

src/test/clojure/cljs/analyzer_tests.clj

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -998,19 +998,14 @@
998998
(is (= 1 (count @ws)))
999999
(is (string/starts-with? (first @ws) "Cannot infer target type"))))
10001000

1001-
(comment
1002-
1003-
(deftest test-cljs-1970-infer-with-cljs-literals
1004-
(let [ws (atom [])
1005-
res (infer-test-helper
1006-
{:forms '[(ns cjls-1970.core)
1007-
(set! *warn-on-infer* true)
1008-
(defn foo [] (list))
1009-
(defn bar [] (vector))]
1010-
:externs ["src/test/externs/test.js"]
1011-
:warnings ws
1012-
:with-core? true})]
1013-
(println @ws)
1014-
(is (zero? (count @ws)))))
1015-
1016-
)
1001+
(deftest test-cljs-1970-infer-with-cljs-literals
1002+
(let [ws (atom [])
1003+
res (infer-test-helper
1004+
{:forms '[(ns cjls-1970.core)
1005+
(set! *warn-on-infer* true)
1006+
(defn foo [] (list))
1007+
(defn bar [] (vector))]
1008+
:externs ["src/test/externs/test.js"]
1009+
:warnings ws
1010+
:with-core? true})]
1011+
(is (zero? (count @ws)))))

0 commit comments

Comments
 (0)