File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -12273,7 +12273,7 @@ reduces them without incurring seq initialization"
12273
12273
(when (nil? NS_CACHE)
12274
12274
(set! NS_CACHE (atom {})))
12275
12275
(let [ns-str (str_ ns )
12276
- ns (if (not ^boolean (gstring/contains ns-str " $macros" ))
12276
+ ns (if (not (gstring/contains ns-str " $macros" ))
12277
12277
(symbol (str_ ns-str " $macros" ))
12278
12278
ns )
12279
12279
the-ns (get @NS_CACHE ns )]
@@ -12297,7 +12297,7 @@ reduces them without incurring seq initialization"
12297
12297
[x]
12298
12298
(instance? goog.Uri x))
12299
12299
12300
- (defn ^boolean NaN?
12300
+ (defn NaN?
12301
12301
" Returns true if num is NaN, else false"
12302
12302
[val]
12303
12303
(js/isNaN val))
@@ -12326,6 +12326,7 @@ reduces them without incurring seq initialization"
12326
12326
[s]
12327
12327
(if (string? s)
12328
12328
(cond
12329
+ ; ; FIXME: another cases worth thinking about
12329
12330
^boolean (re-matches #"[\x 00-\x 20]*[+-]?NaN[\x 00-\x 20]*" s) ##NaN
12330
12331
^boolean (re-matches
12331
12332
#"[\x 00-\x 20]*[+-]?(Infinity|((\d +\. ?\d *|\.\d +)([eE][+-]?\d +)?)[dDfF]?)[\x 00-\x 20]*"
Original file line number Diff line number Diff line change 382
382
'[(if (.isNaN js/Number 1 ) true false )]))]
383
383
(is (nil? (re-find #"truth_" code))))))
384
384
385
+ (deftest test-goog-lib-infer-boolean
386
+ (testing " Can infer goog.string/contains returns boolean"
387
+ (let [code (env/with-compiler-env (env/default-compiler-env )
388
+ (compile-form-seq
389
+ '[(ns test.foo
390
+ (:require [goog.string :as gstring]))
391
+ (if (gstring/contain " foobar" " foo" ) true false )]))]
392
+ (is (nil? (re-find #"truth_" code))))))
393
+
385
394
; ; CLJS-1225
386
395
387
396
(comment
Original file line number Diff line number Diff line change 395
395
(Html5History. )]
396
396
{} true ))))))
397
397
398
- ; ; FIXME: infers any instead of boolean, nothing wrong w/ the externs parsing
399
- ; ; but this definitely does not work at the moment
400
- #_(deftest test-goog-infer
398
+ (deftest test-goog-infer
401
399
(is (= 'boolean
400
+ (:tag (env/with-compiler-env (env/default-compiler-env )
401
+ (ana/analyze-form-seq
402
+ '[(ns test.foo
403
+ (:require [goog.string :as gstring]))
404
+ (gstring/contains " foobar" " foo" )]
405
+ {} true )))))
406
+ ; ; FIXME: infers any instead of boolean, nothing wrong w/ the externs parsing
407
+ ; ; but this definitely does not work at the moment
408
+ #_ (is (= 'boolean
402
409
(:tag
403
410
(env/with-compiler-env (env/default-compiler-env )
404
411
(ana/analyze-form-seq
405
412
'[(ns test.foo
406
413
(:require [goog.object :as gobject]))
407
414
(gobject/containsKey (js-object ) " foo" )]
408
415
{} true ))))))
416
+
You can’t perform that action at this time.
0 commit comments