File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 2404
2404
(reset! (:flag frame) true )
2405
2405
(swap! (:tags frame) (fn [tags]
2406
2406
(mapv (fn [tag expr]
2407
- (add-types tag (:tag expr)))
2407
+ ; ; Widen by adding the type of the recur expression, except when recurring with a
2408
+ ; ; loop local: Since its final widened type is unknown, conservatively assume 'any.
2409
+ (if (= :loop (:local expr))
2410
+ 'any
2411
+ (add-types tag (:tag expr))))
2408
2412
tags exprs)))
2409
2413
(assoc {:env env :op :recur :form form}
2410
2414
:frame frame
Original file line number Diff line number Diff line change 2101
2101
(env/with-compiler-env test-cenv
2102
2102
(:tag (ana/analyze test-env '(let [x ^any []] (if (implements? ICounted x) x nil ))))))
2103
2103
'#{cljs.core/ICounted clj-nil})))
2104
+
2105
+ (deftest test-cljs-3158
2106
+ (is (= (ana/no-warn
2107
+ (env/with-compiler-env test-cenv
2108
+ (:tag (analyze test-env '(loop [a " x" b " y" ]
2109
+ (if (= a 1 )
2110
+ a
2111
+ (recur b 1 )))))))
2112
+ 'any)))
You can’t perform that action at this time.
0 commit comments