diff --git a/src/main/clojure/cljs/analyzer.cljc b/src/main/clojure/cljs/analyzer.cljc index 31afe38d4d..ac66b9281a 100644 --- a/src/main/clojure/cljs/analyzer.cljc +++ b/src/main/clojure/cljs/analyzer.cljc @@ -2915,11 +2915,16 @@ (every? symbol? spec)) (and (symbol? spec) (nil? (namespace spec)))) (throw (error env (parse-ns-error-msg spec "Only lib.ns.Ctor or [lib.ns Ctor*] spec supported in :import")))) - (let [import-map (if (sequential? spec) + (let [import-map (cond + (sequential? spec) (->> (rest spec) (map #(vector % (symbol (str (first spec) "." %)))) (into {})) - {(symbol (last (string/split (str spec) #"\."))) spec})] + + (not (== -1 (.indexOf (str spec) "."))) + {(symbol (last (string/split (str spec) #"\."))) spec} + + :else {})] (doseq [[_ spec] import-map] (swap! deps conj spec)) {:import import-map diff --git a/src/test/clojure/cljs/analyzer_tests.clj b/src/test/clojure/cljs/analyzer_tests.clj index 542f93656e..6c0041f92c 100644 --- a/src/test/clojure/cljs/analyzer_tests.clj +++ b/src/test/clojure/cljs/analyzer_tests.clj @@ -1485,13 +1485,10 @@ (:import [goog.history Html5History]))])) (is (some? (get-in @cenv [::ana/namespaces 'goog.history.Html5History :defs 'Html5History]))))) -(comment - +(deftest test-cljs-3239 (let [cenv (env/default-compiler-env)] (env/with-compiler-env cenv (ana/analyze-form-seq '[(ns test.foo - (:import [goog.history Html5History]))])) - (get-in @cenv [::ana/namespaces 'goog.history.Html5History :defs])) - - ) + (:import goog))])) + (is (= {} (get-in @cenv [::ana/namespaces 'test.foo :imports])))))