Swift: Simplify more tests.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-10-26 14:55:17 +01:00
parent 2ad121a8a5
commit 96a37f3a3c

View File

@@ -68,33 +68,14 @@ func asyncTest() {
}
}
func foo() -> Int {
func foo() {
var x = 1
let f = { y in x += y }
x = source("foo", 41)
let r = { x }
sink(r()) // $ hasValueFlow=foo
f(1)
return r()
}
func bar() -> () -> Int {
var x = 1
let f = { y in x += y }
x = source("bar", 41)
let r = { x }
f(1)
return r // constantly 42
}
var g: ((Int) -> Void)? = nil
func baz() -> () -> Int {
var x = 1
g = { y in x += y }
x = source("baz", 41)
let r = { x }
g!(1)
return r
sink(r()) // $ hasValueFlow=foo
}
func sharedCapture() {