File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 159159 :protocol-impl-recur-with-target true
160160 :single-segment-namespace true
161161 :munged-namespace true
162+ :js-used-as-alias true
162163 :ns-var-clash true
163164 :non-dynamic-earmuffed-var true
164165 :extend-type-invalid-method-shape true
439440 (str " Namespace " name " contains a reserved JavaScript keyword,"
440441 " the corresponding Google Closure namespace will be munged to " munged)))
441442
443+ (defmethod error-message :js-used-as-alias
444+ [warning-type {:keys [spec] :as info}]
445+ (str " In " (pr-str spec) " , the alias name js is reserved for JavaScript interop" ))
446+
442447(defmethod error-message :ns-var-clash
443448 [warning-type {:keys [ns var] :as info}]
444449 (str " Namespace " ns " clashes with var " var))
29942999 lib' ((alias-type @aliases) alias)]
29953000 (when (and (some? lib') (not= lib lib'))
29963001 (throw (error env (parse-ns-error-msg spec " :as alias must be unique" ))))
3002+ (when (= alias 'js)
3003+ (when-not (= lib (get-in @aliases [(if macros? :fns :macros ) 'js])) ; warn only once
3004+ (warning :js-used-as-alias env {:spec spec})))
29973005 (swap! aliases
29983006 update-in [alias-type]
29993007 conj [alias lib] (when js-module-provides [js-module-provides lib]))))
Original file line number Diff line number Diff line change 14931493 (:import goog))]))
14941494 (is (= {} (get-in @cenv [::ana/namespaces 'test.foo :imports ])))))
14951495
1496+ (deftest test-cljs-3320
1497+ (let [ws (atom [])]
1498+ (ana/with-warning-handlers [(collecting-warning-handler ws)]
1499+ (binding [ana/*cljs-ns* 'cljs.user]
1500+ (analyze ns-env '(ns cljs3320.core (:require [cljs.js :as js])))))
1501+ (is (string/includes? (first @ws) " the alias name js is reserved for JavaScript interop" ))))
1502+
14961503(deftest test-cljs-3371
14971504 (let [ws (atom [])]
14981505 (ana/with-warning-handlers [(collecting-warning-handler ws)]
You can’t perform that action at this time.
0 commit comments