Skip to content

Commit b3185e9

Browse files
committed
Swift: Expand the test case.
1 parent bb1720d commit b3185e9

File tree

3 files changed

+36
-9
lines changed

3 files changed

+36
-9
lines changed

swift/ql/test/library-tests/dataflow/dataflow/DataFlow.expected

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@ edges
558558
| test.swift:873:21:873:31 | [...] [Collection element] | test.swift:856:29:856:40 | args [Collection element] |
559559
| test.swift:873:21:873:31 | [...] [Collection element] | test.swift:873:21:873:31 | [...] [Collection element] |
560560
| test.swift:873:24:873:31 | call to source() | test.swift:873:21:873:31 | [...] [Collection element] |
561-
| test.swift:881:12:881:21 | call to source() | test.swift:881:12:881:21 | OpenExistentialExpr |
561+
| test.swift:888:12:888:21 | call to source() | test.swift:888:12:888:21 | OpenExistentialExpr |
562+
| test.swift:890:12:890:35 | call to source() | test.swift:890:12:890:35 | OpenExistentialExpr |
562563
nodes
563564
| file://:0:0:0:0 | .a [x] | semmle.label | .a [x] |
564565
| file://:0:0:0:0 | .s [x] | semmle.label | .s [x] |
@@ -1160,8 +1161,12 @@ nodes
11601161
| test.swift:873:21:873:31 | [...] [Collection element] | semmle.label | [...] [Collection element] |
11611162
| test.swift:873:21:873:31 | [...] [Collection element] | semmle.label | [...] [Collection element] |
11621163
| test.swift:873:24:873:31 | call to source() | semmle.label | call to source() |
1163-
| test.swift:881:12:881:21 | OpenExistentialExpr | semmle.label | OpenExistentialExpr |
1164-
| test.swift:881:12:881:21 | call to source() | semmle.label | call to source() |
1164+
| test.swift:888:12:888:21 | OpenExistentialExpr | semmle.label | OpenExistentialExpr |
1165+
| test.swift:888:12:888:21 | call to source() | semmle.label | call to source() |
1166+
| test.swift:889:12:889:21 | call to source() | semmle.label | call to source() |
1167+
| test.swift:890:12:890:35 | OpenExistentialExpr | semmle.label | OpenExistentialExpr |
1168+
| test.swift:890:12:890:35 | call to source() | semmle.label | call to source() |
1169+
| test.swift:891:12:891:39 | call to source() | semmle.label | call to source() |
11651170
subpaths
11661171
| test.swift:75:22:75:22 | x | test.swift:65:16:65:28 | arg1 | test.swift:65:1:70:1 | arg2[return] | test.swift:75:32:75:32 | [post] y |
11671172
| test.swift:114:19:114:19 | arg | test.swift:109:9:109:14 | arg | test.swift:110:12:110:12 | arg | test.swift:114:12:114:22 | call to ... |
@@ -1351,4 +1356,7 @@ subpaths
13511356
| test.swift:859:15:859:21 | ...[...] | test.swift:873:24:873:31 | call to source() | test.swift:859:15:859:21 | ...[...] | result |
13521357
| test.swift:860:15:860:21 | ...[...] | test.swift:873:24:873:31 | call to source() | test.swift:860:15:860:21 | ...[...] | result |
13531358
| test.swift:867:15:867:38 | \\...[...] | test.swift:873:24:873:31 | call to source() | test.swift:867:15:867:38 | \\...[...] | result |
1354-
| test.swift:881:12:881:21 | OpenExistentialExpr | test.swift:881:12:881:21 | call to source() | test.swift:881:12:881:21 | OpenExistentialExpr | result |
1359+
| test.swift:888:12:888:21 | OpenExistentialExpr | test.swift:888:12:888:21 | call to source() | test.swift:888:12:888:21 | OpenExistentialExpr | result |
1360+
| test.swift:889:12:889:21 | call to source() | test.swift:889:12:889:21 | call to source() | test.swift:889:12:889:21 | call to source() | result |
1361+
| test.swift:890:12:890:35 | OpenExistentialExpr | test.swift:890:12:890:35 | call to source() | test.swift:890:12:890:35 | OpenExistentialExpr | result |
1362+
| test.swift:891:12:891:39 | call to source() | test.swift:891:12:891:39 | call to source() | test.swift:891:12:891:39 | call to source() | result |

swift/ql/test/library-tests/dataflow/dataflow/LocalFlow.expected

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,15 @@
10871087
| test.swift:871:24:871:31 | [...] | test.swift:871:24:871:31 | [...] |
10881088
| test.swift:872:28:872:31 | [...] | test.swift:872:28:872:31 | [...] |
10891089
| test.swift:873:21:873:31 | [...] | test.swift:873:21:873:31 | [...] |
1090-
| test.swift:880:30:880:33 | SSA def(x) | test.swift:881:12:881:12 | x |
1091-
| test.swift:880:30:880:33 | x | test.swift:880:30:880:33 | SSA def(x) |
1092-
| test.swift:881:12:881:21 | call to source() | test.swift:881:12:881:21 | OpenExistentialExpr |
1090+
| test.swift:880:7:880:7 | SSA def(self) | test.swift:880:7:880:7 | self[return] |
1091+
| test.swift:880:7:880:7 | SSA def(self) | test.swift:880:7:880:7 | self[return] |
1092+
| test.swift:880:7:880:7 | self | test.swift:880:7:880:7 | SSA def(self) |
1093+
| test.swift:880:7:880:7 | self | test.swift:880:7:880:7 | SSA def(self) |
1094+
| test.swift:881:7:881:7 | SSA def(self) | test.swift:881:2:881:34 | self[return] |
1095+
| test.swift:881:7:881:7 | self | test.swift:881:7:881:7 | SSA def(self) |
1096+
| test.swift:887:30:887:33 | SSA def(x) | test.swift:888:12:888:12 | x |
1097+
| test.swift:887:30:887:33 | x | test.swift:887:30:887:33 | SSA def(x) |
1098+
| test.swift:887:45:887:48 | SSA def(y) | test.swift:889:12:889:12 | y |
1099+
| test.swift:887:45:887:48 | y | test.swift:887:45:887:48 | SSA def(y) |
1100+
| test.swift:888:12:888:21 | call to source() | test.swift:888:12:888:21 | OpenExistentialExpr |
1101+
| test.swift:890:12:890:35 | call to source() | test.swift:890:12:890:35 | OpenExistentialExpr |

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,16 @@ protocol MyProtocol {
877877
func source() -> Int
878878
}
879879

880-
func testOpenExistentialExpr(x: MyProtocol) {
881-
sink(arg: x.source()) // $ flow=881
880+
class MyProcotolImpl : MyProtocol {
881+
func source() -> Int { return 0 }
882+
}
883+
884+
func getMyProtocol() -> MyProtocol { return MyProcotolImpl() }
885+
func getMyProtocolImpl() -> MyProcotolImpl { return MyProcotolImpl() }
886+
887+
func testOpenExistentialExpr(x: MyProtocol, y: MyProcotolImpl) {
888+
sink(arg: x.source()) // $ flow=888
889+
sink(arg: y.source()) // $ flow=889
890+
sink(arg: getMyProtocol().source()) // $ flow=890
891+
sink(arg: getMyProtocolImpl().source()) // $ flow=891
882892
}

0 commit comments

Comments
 (0)