Skip to content

Commit

Permalink
CLJS-1763: Defining a var that clashes with cljs.core throws a comp…
Browse files Browse the repository at this point in the history
…iler error instead of warning
  • Loading branch information
anmonteiro authored and dnolen committed Aug 24, 2016
1 parent a518320 commit 7a06d00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/clojure/cljs/analyzer.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,7 @@
(fn [s [k & filters]]
(if (= k :refer-clojure)
(do
(when (seq s)
(when (seq (:excludes s))
(throw (error env "Only one :refer-clojure form is allowed per namespace definition")))
(let [valid-kws #{:exclude :rename}
xs
Expand Down Expand Up @@ -1924,7 +1924,8 @@
:else ret))]
(merge-with into s xs)))
s))
{} args))
{:excludes #{}
:renames {}} args))

(defn use->require [env [lib & filters :as spec]]
(when-not (and (symbol? lib) (odd? (count spec)))
Expand Down
7 changes: 7 additions & 0 deletions src/test/clojure/cljs/analyzer_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -449,3 +449,10 @@
(is (thrown-with-msg? Exception #"Can't def ns-qualified name in namespace foo.core"
(a/analyze test-env '(def foo.core/foo 43))))
(is (a/analyze test-env '(def cljs.user/foo 43))))))

(deftest test-cljs-1763
(let [parsed (a/parse-ns-excludes {} '())]
(is (= parsed
{:excludes #{}
:renames {}}))
(is (set? (:excludes parsed)))))

0 comments on commit 7a06d00

Please sign in to comment.