Skip to content

Commit 6444d0b

Browse files
committed
unified: Add test with chain of accessors
1 parent edc465e commit 6444d0b

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

‎unified/ql/test/library-tests/dataflow/accessors_local.swift‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,15 @@ func t9() {
7272
y = source("t9.1")
7373
closure()
7474
}
75+
76+
func t10() {
77+
var y: String = "safe"
78+
var x1: String { y }
79+
var x2: String { x1 }
80+
var x3: String { x2 }
81+
let closure = {
82+
sink(x3) // $ hasValueFlow=t9.1
83+
}
84+
y = source("t9.1")
85+
closure()
86+
}

‎unified/ql/test/library-tests/dataflow/test.expected‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ edges
4545
| accessors_local.swift:72:5:72:5 | y | accessors_local.swift:73:5:73:11 | closure [y] | provenance | |
4646
| accessors_local.swift:72:9:72:22 | source(...) | accessors_local.swift:72:5:72:5 | y | provenance | |
4747
| accessors_local.swift:73:5:73:11 | closure [y] | accessors_local.swift:70:14:70:14 | x | provenance | |
48+
| accessors_local.swift:84:5:84:5 | y | accessors_local.swift:85:5:85:11 | closure [y] | provenance | |
49+
| accessors_local.swift:84:9:84:22 | source(...) | accessors_local.swift:84:5:84:5 | y | provenance | |
50+
| accessors_local.swift:85:5:85:11 | closure [y] | accessors_local.swift:82:14:82:15 | x3 | provenance | |
4851
| accessors_static.swift:8:32:8:45 | source(...) | accessors_static.swift:10:10:10:12 | ... .x | provenance | |
4952
| accessors_static.swift:18:19:18:32 | source(...) | accessors_static.swift:21:10:21:12 | ... .x | provenance | |
5053
| accessors_static.swift:27:19:27:32 | source(...) | accessors_static.swift:31:10:31:12 | ... .x | provenance | |
@@ -579,6 +582,10 @@ nodes
579582
| accessors_local.swift:72:5:72:5 | y | semmle.label | y |
580583
| accessors_local.swift:72:9:72:22 | source(...) | semmle.label | source(...) |
581584
| accessors_local.swift:73:5:73:11 | closure [y] | semmle.label | closure [y] |
585+
| accessors_local.swift:82:14:82:15 | x3 | semmle.label | x3 |
586+
| accessors_local.swift:84:5:84:5 | y | semmle.label | y |
587+
| accessors_local.swift:84:9:84:22 | source(...) | semmle.label | source(...) |
588+
| accessors_local.swift:85:5:85:11 | closure [y] | semmle.label | closure [y] |
582589
| accessors_static.swift:8:32:8:45 | source(...) | semmle.label | source(...) |
583590
| accessors_static.swift:10:10:10:12 | ... .x | semmle.label | ... .x |
584591
| accessors_static.swift:18:19:18:32 | source(...) | semmle.label | source(...) |
@@ -1197,6 +1204,7 @@ testFailures
11971204
| accessors_local.swift:55:10:55:10 | x | accessors_local.swift:54:9:54:22 | source(...) | accessors_local.swift:55:10:55:10 | x | $@ | accessors_local.swift:54:9:54:22 | source(...) | source(...) |
11981205
| accessors_local.swift:61:14:61:14 | x | accessors_local.swift:59:21:59:34 | source(...) | accessors_local.swift:61:14:61:14 | x | $@ | accessors_local.swift:59:21:59:34 | source(...) | source(...) |
11991206
| accessors_local.swift:70:14:70:14 | x | accessors_local.swift:72:9:72:22 | source(...) | accessors_local.swift:70:14:70:14 | x | $@ | accessors_local.swift:72:9:72:22 | source(...) | source(...) |
1207+
| accessors_local.swift:82:14:82:15 | x3 | accessors_local.swift:84:9:84:22 | source(...) | accessors_local.swift:82:14:82:15 | x3 | $@ | accessors_local.swift:84:9:84:22 | source(...) | source(...) |
12001208
| accessors_static.swift:10:10:10:12 | ... .x | accessors_static.swift:8:32:8:45 | source(...) | accessors_static.swift:10:10:10:12 | ... .x | $@ | accessors_static.swift:8:32:8:45 | source(...) | source(...) |
12011209
| accessors_static.swift:21:10:21:12 | ... .x | accessors_static.swift:18:19:18:32 | source(...) | accessors_static.swift:21:10:21:12 | ... .x | $@ | accessors_static.swift:18:19:18:32 | source(...) | source(...) |
12021210
| accessors_static.swift:31:10:31:12 | ... .x | accessors_static.swift:27:19:27:32 | source(...) | accessors_static.swift:31:10:31:12 | ... .x | $@ | accessors_static.swift:27:19:27:32 | source(...) | source(...) |

0 commit comments

Comments
 (0)