Swift: Fix test by including the 'allowParameterReturnInSelf' hook from the variable capture library.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-10-27 11:25:19 +01:00
parent 9b150e4ea9
commit 68999f3cef
2 changed files with 7 additions and 2 deletions

View File

@@ -1387,7 +1387,12 @@ predicate additionalLambdaFlowStep(Node nodeFrom, Node nodeTo, boolean preserves
* One example would be to allow flow like `p.foo = p.bar;`, which is disallowed
* by default as a heuristic.
*/
predicate allowParameterReturnInSelf(ParameterNode p) { none() }
predicate allowParameterReturnInSelf(ParameterNode p) {
exists(Callable c |
c = p.(ParameterNodeImpl).getEnclosingCallable().asSourceCallable() and
CaptureFlow::heuristicAllowInstanceParameterReturnInSelf(c)
)
}
/** An approximated `Content`. */
class ContentApprox = Unit;

View File

@@ -187,5 +187,5 @@ func multi() {
var y = source("multi", 1)
var f = { () in x = y }
f()
sink(x) // $ MISSING: hasValueFlow=multi
sink(x) // $ hasValueFlow=multi
}