We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2ad121a commit 96a37f3Copy full SHA for 96a37f3
swift/ql/test/library-tests/dataflow/capture/closures.swift
@@ -68,33 +68,14 @@ func asyncTest() {
68
}
69
70
71
-func foo() -> Int {
+func foo() {
72
var x = 1
73
let f = { y in x += y }
74
x = source("foo", 41)
75
let r = { x }
76
sink(r()) // $ hasValueFlow=foo
77
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
93
- g = { y in x += y }
94
- x = source("baz", 41)
95
96
- g!(1)
97
- return r
+ sink(r()) // $ hasValueFlow=foo
98
99
100
func sharedCapture() {
0 commit comments