Details
-
Type:
Defect
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
Evaluate the following in a ./script/repl session
(require '[cljs.compiler :as comp])
(require '[cljs.analyzer :as ana])
;; This trickery seems to be the minimum logic to prepare a top level namespace
(def repl-env
(binding [ana/*cljs-ns* 'cljs.user]
(-> (ana/empty-env)
(ana/analyze '(ns some-ns))
:env
(assoc :ns (ana/get-namespace ana/*cljs-ns*)))))
(defn analyze [form]
(binding [ana/*cljs-warn-on-undeclared* true]
(ana/analyze repl-env form)))
(-> '(defprotocol P
(f [_ x]))
analyze
keys) ; keys is just so the output isn't huge
The first time you evaluate that last form, you get an error like this one:
WARNING: Use of undeclared Var some-ns/f at line 45
You'll get similar errors each time you rename f and re-evaluate the form.
Seems like the underlying issue is referring to a var while it is being defined. This form exhibits the same issue:
(def f [x] (aget f "prototype"))(def f [x] (aget f "prototype"))