Details
Description
I'm experimenting with using the analyzer for some more sophisticated macros, including a CPS transform and control constructs. During interactive development, I discovered that the analyzer is incorrectly merging metadata on vars when redefining them. This patch changes redef's to replace, rather than merge, existing var metadata.
The patch does not include a test, since the tests don't currently muck with the analyzer directly. Here's some code you can play with in your repl:
(require '[cljs.analyzer :as ana])
(require '[cljs.compiler :as comp])
(def env (ana/empty-env))
(defn show-foo [form]
(ana/analyze env form)
(-> @ana/namespaces (get 'cljs.user) :defs (get 'x) :foo))
(show-foo '(def ^{:foo 1} x 1))
(show-foo '(def ^{:foo 2} x 1))
(show-foo '(def x 1)) ; before patch, this returns 2. After patch, nil.
fixed, http://github.com/clojure/clojurescript/commit/8355d1eacff667b77551bb60699d5c85b2f15298