Skip to content

Commit ab7cd52

Browse files
committed
Swift: update dataflow test for nil coalescing
1 parent 9a5fa42 commit ab7cd52

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ edges
139139
| test.swift:270:15:270:22 | call to source() | test.swift:270:15:270:31 | call to signum() |
140140
| test.swift:271:15:271:16 | ...? | test.swift:271:15:271:25 | call to signum() |
141141
| test.swift:271:15:271:25 | call to signum() | test.swift:271:15:271:25 | OptionalEvaluationExpr |
142+
| test.swift:275:20:275:27 | call to source() | test.swift:275:15:275:27 | ... ??(_:_:) ... |
143+
| test.swift:277:20:277:27 | call to source() | test.swift:277:15:277:27 | ... ??(_:_:) ... |
142144
| test.swift:279:26:279:26 | x [some:0] | test.swift:279:26:279:27 | ...! |
143145
| test.swift:279:26:279:27 | ...! | test.swift:279:15:279:31 | ... ? ... : ... |
144146
| test.swift:280:26:280:26 | x [some:0] | test.swift:280:26:280:27 | ...! |
@@ -673,6 +675,9 @@ nodes
673675
| test.swift:271:15:271:25 | call to signum() | semmle.label | call to signum() |
674676
| test.swift:274:15:274:20 | ... ??(_:_:) ... | semmle.label | ... ??(_:_:) ... |
675677
| test.swift:275:15:275:27 | ... ??(_:_:) ... | semmle.label | ... ??(_:_:) ... |
678+
| test.swift:275:20:275:27 | call to source() | semmle.label | call to source() |
679+
| test.swift:277:15:277:27 | ... ??(_:_:) ... | semmle.label | ... ??(_:_:) ... |
680+
| test.swift:277:20:277:27 | call to source() | semmle.label | call to source() |
676681
| test.swift:279:15:279:31 | ... ? ... : ... | semmle.label | ... ? ... : ... |
677682
| test.swift:279:26:279:26 | x [some:0] | semmle.label | x [some:0] |
678683
| test.swift:279:26:279:27 | ...! | semmle.label | ...! |
@@ -1187,6 +1192,8 @@ subpaths
11871192
| test.swift:271:15:271:25 | OptionalEvaluationExpr | test.swift:259:12:259:19 | call to source() | test.swift:271:15:271:25 | OptionalEvaluationExpr | result |
11881193
| test.swift:274:15:274:20 | ... ??(_:_:) ... | test.swift:259:12:259:19 | call to source() | test.swift:274:15:274:20 | ... ??(_:_:) ... | result |
11891194
| test.swift:275:15:275:27 | ... ??(_:_:) ... | test.swift:259:12:259:19 | call to source() | test.swift:275:15:275:27 | ... ??(_:_:) ... | result |
1195+
| test.swift:275:15:275:27 | ... ??(_:_:) ... | test.swift:275:20:275:27 | call to source() | test.swift:275:15:275:27 | ... ??(_:_:) ... | result |
1196+
| test.swift:277:15:277:27 | ... ??(_:_:) ... | test.swift:277:20:277:27 | call to source() | test.swift:277:15:277:27 | ... ??(_:_:) ... | result |
11901197
| test.swift:279:15:279:31 | ... ? ... : ... | test.swift:259:12:259:19 | call to source() | test.swift:279:15:279:31 | ... ? ... : ... | result |
11911198
| test.swift:280:15:280:38 | ... ? ... : ... | test.swift:259:12:259:19 | call to source() | test.swift:280:15:280:38 | ... ? ... : ... | result |
11921199
| test.swift:280:15:280:38 | ... ? ... : ... | test.swift:280:31:280:38 | call to source() | test.swift:280:15:280:38 | ... ? ... : ... | result |

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,19 @@
247247
| test.swift:272:15:272:25 | call to signum() | test.swift:272:15:272:25 | OptionalEvaluationExpr |
248248
| test.swift:274:15:274:15 | x | test.swift:274:15:274:20 | ... ??(_:_:) ... |
249249
| test.swift:274:15:274:15 | x | test.swift:275:15:275:15 | x |
250+
| test.swift:274:20:274:20 | 0 | test.swift:274:15:274:20 | ... ??(_:_:) ... |
250251
| test.swift:274:20:274:20 | { ... } | test.swift:274:15:274:20 | ... ??(_:_:) ... |
251252
| test.swift:275:15:275:15 | x | test.swift:275:15:275:27 | ... ??(_:_:) ... |
252253
| test.swift:275:15:275:15 | x | test.swift:279:15:279:15 | x |
254+
| test.swift:275:20:275:27 | call to source() | test.swift:275:15:275:27 | ... ??(_:_:) ... |
253255
| test.swift:275:20:275:27 | { ... } | test.swift:275:15:275:27 | ... ??(_:_:) ... |
254256
| test.swift:276:15:276:15 | y | test.swift:276:15:276:20 | ... ??(_:_:) ... |
255257
| test.swift:276:15:276:15 | y | test.swift:277:15:277:15 | y |
258+
| test.swift:276:20:276:20 | 0 | test.swift:276:15:276:20 | ... ??(_:_:) ... |
256259
| test.swift:276:20:276:20 | { ... } | test.swift:276:15:276:20 | ... ??(_:_:) ... |
257260
| test.swift:277:15:277:15 | y | test.swift:277:15:277:27 | ... ??(_:_:) ... |
258261
| test.swift:277:15:277:15 | y | test.swift:281:15:281:15 | y |
262+
| test.swift:277:20:277:27 | call to source() | test.swift:277:15:277:27 | ... ??(_:_:) ... |
259263
| test.swift:277:20:277:27 | { ... } | test.swift:277:15:277:27 | ... ??(_:_:) ... |
260264
| test.swift:279:15:279:15 | x | test.swift:279:26:279:26 | x |
261265
| test.swift:279:15:279:15 | x | test.swift:280:15:280:15 | x |

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,9 @@ func test_optionals(y: Int?) {
272272
sink(opt: y?.signum())
273273

274274
sink(arg: x ?? 0) // $ flow=259
275-
sink(arg: x ?? source()) // $ flow=259 MISSING: flow=276
275+
sink(arg: x ?? source()) // $ flow=259 flow=275
276276
sink(arg: y ?? 0)
277-
sink(arg: y ?? source()) // $ MISSING: flow=278
277+
sink(arg: y ?? source()) // $ flow=277
278278

279279
sink(arg: x != nil ? x! : 0) // $ flow=259
280280
sink(arg: x != nil ? x! : source()) // $ flow=259 flow=280

0 commit comments

Comments
 (0)