Skip to content

Commit c15e125

Browse files
committed
narrow the previous commit, satisfies? cannot be involved in inference
because they may not be direct implementers of the protocol so the fast path is not safe.
1 parent 09ff331 commit c15e125

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/cljs/cljs/core.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9960,7 +9960,7 @@ reduces them without incurring seq initialization"
99609960

99619961
; Use the new, more efficient, IPrintWithWriter interface when possible.
99629962
(satisfies? IPrintWithWriter obj)
9963-
(-pr-writer ^any obj writer opts)
9963+
(-pr-writer obj writer opts)
99649964

99659965
(or (true? obj) (false? obj))
99669966
(-write writer (str obj))

src/main/clojure/cljs/analyzer.cljc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,14 +1523,14 @@
15231523

15241524
(defn- type-check-induced-tag
15251525
"Look for a type-check-induced tag when the test expression is the use of
1526-
satisfies? or instance? on a local, as in (satisfies? ICounted x)."
1526+
instance? on a local, as in (instance? ICounted x)."
15271527
[env test]
15281528
(when (and (list? test)
15291529
(== 3 (count test))
15301530
(every? symbol? test))
15311531
(let [analyzed-fn (no-warn (analyze (assoc env :context :expr) (first test)))]
15321532
(when (= :var (:op analyzed-fn))
1533-
(when ('#{cljs.core/satisfies? cljs.core/instance?} (:name analyzed-fn))
1533+
(when ('#{cljs.core/instance?} (:name analyzed-fn))
15341534
(let [analyzed-type (no-warn (analyze (assoc env :context :expr) (second test)))
15351535
tag (:name analyzed-type)
15361536
sym (last test)]
@@ -1541,7 +1541,7 @@
15411541

15421542
(defn- add-predicate-induced-tags
15431543
"Looks at the test and adds any tags which are induced by virtue
1544-
of the predicate being satisfied. For exmaple in (if (string? x) x :bar)
1544+
of the predicate being satisfied. For example in (if (string? x) x :bar)
15451545
the local x in the then branch must be of string type."
15461546
[env test]
15471547
(let [[local tag] (or (simple-predicate-induced-tag env test)

0 commit comments

Comments
 (0)