We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 561d65a commit 0285a47Copy full SHA for 0285a47
2 files changed
src/main/clojure/cljs/compiler.cljc
@@ -641,7 +641,8 @@
641
642
(defn safe-test? [env e]
643
(let [tag (ana/infer-tag env e)]
644
- (or ('#{boolean seq js/Boolean} tag) (truthy-constant? e))))
+ (or ('#{boolean seq} (ana/js-prim-ctor->tag tag tag))
645
+ (truthy-constant? e))))
646
647
(defmethod emit* :if
648
[{:keys [test then else env unchecked]}]
src/test/clojure/cljs/externs_infer_tests.clj
@@ -163,6 +163,11 @@
163
(env/with-compiler-env (env/default-compiler-env)
164
(analyze (ana/empty-env) '(let [x js/Number]
165
(.isNaN x 1)))))
166
+ :tag)))
167
+ (is (= 'js/Promise
168
+ (-> (binding [ana/*cljs-ns* ana/*cljs-ns*]
169
+ (env/with-compiler-env (env/default-compiler-env)
170
+ (analyze (ana/empty-env) '(.generateKey js/crypto.subtle))))
171
:tag))))
172
173
(deftest test-externs-infer
0 commit comments