Skip to content

Commit 31967cc

Browse files
committed
Swift: Add a couple of dataflow test cases for operators that behave as an identity function.
1 parent 1fb2735 commit 31967cc

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ nodes
324324
| test.swift:472:20:472:20 | cx [x] : | semmle.label | cx [x] : |
325325
| test.swift:472:20:472:23 | .x : | semmle.label | .x : |
326326
| test.swift:473:15:473:15 | z1 | semmle.label | z1 |
327+
| test.swift:480:14:480:21 | call to source() | semmle.label | call to source() |
327328
subpaths
328329
| test.swift:75:21:75:22 | &... : | test.swift:65:16:65:28 | arg1 : | test.swift:65:1:70:1 | arg2[return] : | test.swift:75:31:75:32 | [post] &... : |
329330
| 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 ... : |
@@ -408,3 +409,4 @@ subpaths
408409
| test.swift:361:15:361:18 | .1 | test.swift:351:31:351:38 | call to source() : | test.swift:361:15:361:18 | .1 | result |
409410
| test.swift:442:19:442:19 | a | test.swift:259:12:259:19 | call to source() : | test.swift:442:19:442:19 | a | result |
410411
| test.swift:473:15:473:15 | z1 | test.swift:259:12:259:19 | call to source() : | test.swift:473:15:473:15 | z1 | result |
412+
| test.swift:480:14:480:21 | call to source() | test.swift:480:14:480:21 | call to source() | test.swift:480:14:480:21 | call to source() | result |

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,3 +474,8 @@ func testOptionalPropertyAccess(y: Int?) {
474474
guard let z2 = cy.x else { return }
475475
sink(arg: z2)
476476
}
477+
478+
func testIdentityArithmetic() {
479+
sink(arg: +source()) // $ MISSING: flow=479
480+
sink(arg: (source())) // $ flow=480
481+
}

0 commit comments

Comments
 (0)