Skip to content

Commit ffca26b

Browse files
author
dnolen
committed
CLJS-2385: cljs.analyzer/infer-type pass infers tag with incorrect priority
1 parent 682f5fe commit ffca26b

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/main/clojure/cljs/analyzer.cljc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,11 +1198,11 @@
11981198
{:op :constant :env env :form sym :tag 'cljs.core/Keyword})
11991199

12001200
(defn get-tag [e]
1201-
(if-some [tag (-> e :tag)]
1201+
(if-some [tag (-> e :form meta :tag)]
1202+
tag
1203+
(if-some [tag (-> e :tag)]
12021204
tag
1203-
(if-some [tag (-> e :info :tag)]
1204-
tag
1205-
(-> e :form meta :tag))))
1205+
(-> e :info :tag))))
12061206

12071207
(defn find-matching-method [f params]
12081208
;; if local fn, need to look in :info

src/test/clojure/cljs/analyzer_tests.clj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,3 +1022,15 @@
10221022
:warnings ws
10231023
:with-core? true})]
10241024
(is (zero? (count @ws)))))
1025+
1026+
(deftest test-cljs-2385-infer-priority
1027+
(let [ws (atom [])
1028+
res (infer-test-helper
1029+
{:forms '[(ns cjls-1918.core)
1030+
(defn thing [{:as this}]
1031+
(.componentDidUpdate ^js/Thing this))]
1032+
:externs ["src/test/externs/test.js"]
1033+
:warnings ws
1034+
:with-core? true})]
1035+
(is (string/includes? res "Thing.prototype.componentDidUpdate;"))
1036+
(is (zero? (count @ws)))))

0 commit comments

Comments
 (0)