File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1599
1599
1600
1600
(defn- type-check-induced-tag
1601
1601
" 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)."
1603
1604
[env test]
1604
1605
(when (and (list? test)
1605
1606
(== 3 (count test))
1606
1607
(every? symbol? test))
1607
1608
(let [analyzed-fn (no-warn (analyze (assoc env :context :expr ) (first test)))]
1608
1609
(when (= :var (:op analyzed-fn))
1609
- (when ('#{cljs.core/instance?} (:name analyzed-fn))
1610
+ (when ('#{cljs.core/instance? cljs.core/implements? } (:name analyzed-fn))
1610
1611
(let [analyzed-type (no-warn (analyze (assoc env :context :expr ) (second test)))
1611
1612
tag (:name analyzed-type)
1612
1613
sym (last test)]
Original file line number Diff line number Diff line change 2091
2091
(env/with-compiler-env test-cenv
2092
2092
(:tag (ana/analyze test-env '(let [x ^any []] (if (qualified-ident? x) x nil ))))))
2093
2093
'#{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