is there a JIRA issue for the when
bug? I keep running into it
What’s the when
bug?
I have this code:
(defn sig []
(when (exists? (.-$$Signature$$ js/window))
(.$$Signature$$ js/window)))
and elsewhere it's usage outputs:
(.cljs$core$IFn$_invoke$arity$0 ? .cljs$core$IFn$_invoke$arity$0() : .call(null));
@lilactown https://clojure.atlassian.net/browse/CLJS-2950 is a nice example of using type inference to speed sth up
(let [forms '[^:meta {:a 1}
{:b 2}]
env (ana/empty-env)]
(for [f forms]
(cljs.analyzer/infer-tag env (ana/analyze env f))))
;; => (nil cljs.core/IMap)
it seems that adding metadata to a form loses it's typehmm. i wonder if it's because my REPL test here is using an empty env
same with a live compiler env
something doesn’t look quite right there
or maybe I’m not sure what you are doing
i see. i can replicate this. looks like the use of ^:meta is blowing away the tag.
[(j/infer-tag {})
(j/infer-tag ^:meta {})
(j/infer-tag ^hello {})
(j/infer-tag (doto {} (alter-meta! assoc :a 1)))]
=> [cljs.core/IMap nil hello cljs.core/IMap]