Skip to content

Commit 2619b1d

Browse files
committed
* move ^boolean hint from special-symbol? to contains? where it belongs
- add test case
1 parent 8625f7f commit 2619b1d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2432,7 +2432,7 @@ reduces them without incurring seq initialization"
24322432
(or (identical? x js/Number.POSITIVE_INFINITY)
24332433
(identical? x js/Number.NEGATIVE_INFINITY)))
24342434

2435-
(defn contains?
2435+
(defn ^boolean contains?
24362436
"Returns true if key is present in the given collection, otherwise
24372437
returns false. Note that for numerically indexed collections like
24382438
vectors and arrays, this tests if the numeric key is within the
@@ -11945,7 +11945,7 @@ reduces them without incurring seq initialization"
1194511945
(fn [x y]
1194611946
(cond (pred x y) -1 (pred y x) 1 :else 0)))
1194711947

11948-
(defn ^boolean special-symbol?
11948+
(defn special-symbol?
1194911949
"Returns true if x names a special form"
1195011950
[x]
1195111951
(contains?

src/test/clojure/cljs/type_inference_tests.clj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@
310310
(is (= (env/with-compiler-env test-cenv
311311
(:tag (analyze test-env '(distinct? 1))))
312312
'boolean))
313+
(is (= (env/with-compiler-env test-cenv
314+
(:tag (analyze test-env '(special-symbol? 'foo))))
315+
'boolean))
313316
;; TODO: we can't infer isa?, we get 'any which is a bit surprising
314317
;(is (= (env/with-compiler-env test-cenv
315318
; (:tag (analyze test-env '(isa? ::foo :bar))))

0 commit comments

Comments
 (0)