Skip to content

Commit 280b7b9

Browse files
committed
CLJS-964: Redefining exists? does not emit a warning like redefining array? does.
cljs.analyzer/core-name? needs to return true for core macros
1 parent ddaa0f1 commit 280b7b9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/clj/cljs/analyzer.clj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
[clojure.edn :as edn])
2121
(:import [java.io File Reader PushbackReader]
2222
[java.net URL]
23+
[clojure.lang Namespace]
2324
[cljs.tagged_literals JSValue]))
2425

2526
(set! *warn-on-reflection* true)
@@ -374,10 +375,15 @@
374375
(nil? (io/resource (util/ns->relpath ns-sym))))
375376
(warning :undeclared-ns env {:ns-sym ns-sym :path (util/ns->relpath ns-sym)})))
376377

378+
(declare get-expander)
379+
377380
(defn core-name?
378381
"Is sym visible from core in the current compilation namespace?"
379382
[env sym]
380-
(and (get-in @env/*compiler* [::namespaces 'cljs.core :defs sym])
383+
(and (or (get-in @env/*compiler* [::namespaces 'cljs.core :defs sym])
384+
(when-let [mac (get-expander sym env)]
385+
(let [^Namespace ns (-> mac meta :ns)]
386+
(= (.getName ns) 'cljs.core))))
381387
(not (contains? (-> env :ns :excludes) sym))))
382388

383389
(defn resolve-var

0 commit comments

Comments
 (0)