Skip to content

Commit fed0807

Browse files
author
dnolen
committed
Merge branch 'cljs-2767'
2 parents 43bc148 + 693cd0d commit fed0807

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

src/main/clojure/cljs/analyzer.cljc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,9 @@
10381038
(when (contains? locals (-> sym name symbol))
10391039
(warning :js-shadowed-by-local env {:name sym}))
10401040
(let [pre (->> (string/split (name sym) #"\.") (map symbol) vec)]
1041-
(when-not (has-extern? pre)
1041+
(when (and (not (has-extern? pre))
1042+
;; ignore exists? usage
1043+
(not (-> sym meta ::no-resolve)))
10421044
(swap! env/*compiler* update-in
10431045
(into [::namespaces (-> env :ns :name) :externs] pre) merge {}))
10441046
(merge
@@ -2928,7 +2930,8 @@
29282930
(vary-meta (normalize-js-tag target-tag)
29292931
update-in [:prefix] (fnil conj '[Object]) prop))
29302932
nil)]
2931-
(when (not (string/starts-with? (str prop) "cljs$"))
2933+
(when (and (not= 'constructor prop)
2934+
(not (string/starts-with? (str prop) "cljs$")))
29322935
;; Adding to Object
29332936
(when (= 'Object (first (-> tag meta :prefix)))
29342937
(warning :infer-warning env

src/main/clojure/cljs/core.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@
18191819
(.. ~other ~(to-property field))))
18201820
base-fields)
18211821
(= (.-__extmap ~this)
1822-
(.-__extmap ~other)))))
1822+
(.-__extmap ~(with-meta other {:tag tagname}))))))
18231823
'IMeta
18241824
`(~'-meta [this#] ~'__meta)
18251825
'IWithMeta

src/test/clojure/cljs/analyzer_tests.clj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,3 +1076,23 @@
10761076
:warnings ws
10771077
:warn false})]
10781078
(is (= (unsplit-lines ["Object.Component;"]) res))))
1079+
1080+
(deftest test-cljs-2767-deftype-defrecord
1081+
(let [ws (atom [])
1082+
res (infer-test-helper
1083+
{:forms '[(ns cjls-2767.core)
1084+
(defrecord Foo [])]
1085+
:externs ["src/test/externs/test.js"]
1086+
:warnings ws
1087+
:with-core? true})]
1088+
(is (empty? @ws))
1089+
(is (not (string/includes? res "cljs.core"))))
1090+
(let [ws (atom [])
1091+
res (infer-test-helper
1092+
{:forms '[(ns cjls-2767.core)
1093+
(deftype Foo [])]
1094+
:externs ["src/test/externs/test.js"]
1095+
:warnings ws
1096+
:with-core? true})]
1097+
(is (empty? @ws))
1098+
(is (not (string/includes? res "cljs.core")))))

0 commit comments

Comments
 (0)