Skip to content

Commit 96a37f3

Browse files
committed
Swift: Simplify more tests.
1 parent 2ad121a commit 96a37f3

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

swift/ql/test/library-tests/dataflow/capture/closures.swift

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,33 +68,14 @@ func asyncTest() {
6868
}
6969
}
7070

71-
func foo() -> Int {
71+
func foo() {
7272
var x = 1
7373
let f = { y in x += y }
7474
x = source("foo", 41)
7575
let r = { x }
7676
sink(r()) // $ hasValueFlow=foo
7777
f(1)
78-
return r()
79-
}
80-
81-
func bar() -> () -> Int {
82-
var x = 1
83-
let f = { y in x += y }
84-
x = source("bar", 41)
85-
let r = { x }
86-
f(1)
87-
return r // constantly 42
88-
}
89-
90-
var g: ((Int) -> Void)? = nil
91-
func baz() -> () -> Int {
92-
var x = 1
93-
g = { y in x += y }
94-
x = source("baz", 41)
95-
let r = { x }
96-
g!(1)
97-
return r
78+
sink(r()) // $ hasValueFlow=foo
9879
}
9980

10081
func sharedCapture() {

0 commit comments

Comments
 (0)