File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 15991599
16001600(defn- type-check-induced-tag
16011601 " Look for a type-check-induced tag when the test expression is the use of
1602- instance? on a local, as in (instance? ICounted x)."
1602+ instance? on a local, as in (instance? UUID x) or implements? on a local, as
1603+ in (implements? ICounted x)."
16031604 [env test]
16041605 (when (and (list? test)
16051606 (== 3 (count test))
16061607 (every? symbol? test))
16071608 (let [analyzed-fn (no-warn (analyze (assoc env :context :expr ) (first test)))]
16081609 (when (= :var (:op analyzed-fn))
1609- (when ('#{cljs.core/instance?} (:name analyzed-fn))
1610+ (when ('#{cljs.core/instance? cljs.core/implements? } (:name analyzed-fn))
16101611 (let [analyzed-type (no-warn (analyze (assoc env :context :expr ) (second test)))
16111612 tag (:name analyzed-type)
16121613 sym (last test)]
Original file line number Diff line number Diff line change 20912091 (env/with-compiler-env test-cenv
20922092 (:tag (ana/analyze test-env '(let [x ^any []] (if (qualified-ident? x) x nil ))))))
20932093 '#{cljs.core/Keyword cljs.core/Symbol clj-nil})))
2094+
2095+ (deftest test-cljs-3140
2096+ (is (= (ana/no-warn
2097+ (env/with-compiler-env test-cenv
2098+ (:tag (ana/analyze test-env '(let [x ^any []] (if (instance? UUID x) x nil ))))))
2099+ '#{cljs.core/UUID clj-nil}))
2100+ (is (= (ana/no-warn
2101+ (env/with-compiler-env test-cenv
2102+ (:tag (ana/analyze test-env '(let [x ^any []] (if (implements? ICounted x) x nil ))))))
2103+ '#{cljs.core/ICounted clj-nil})))
You can’t perform that action at this time.
0 commit comments