Skip to content

Commit 9b38e11

Browse files
committed
Swift: Add more tests of optionals.
1 parent 7bf55c5 commit 9b38e11

File tree

3 files changed

+182
-120
lines changed

3 files changed

+182
-120
lines changed

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

Lines changed: 63 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -100,29 +100,30 @@ edges
100100
| test.swift:225:14:225:21 | call to source() : | test.swift:235:13:235:15 | .source_value |
101101
| test.swift:225:14:225:21 | call to source() : | test.swift:238:13:238:15 | .source_value |
102102
| test.swift:259:12:259:19 | call to source() : | test.swift:263:13:263:28 | call to optionalSource() : |
103-
| test.swift:263:13:263:28 | call to optionalSource() : | test.swift:264:15:264:16 | ...! |
104-
| test.swift:263:13:263:28 | call to optionalSource() : | test.swift:266:15:266:16 | ...? : |
105-
| test.swift:265:15:265:22 | call to source() : | file://:0:0:0:0 | [summary param] this in signum() : |
106-
| test.swift:265:15:265:22 | call to source() : | test.swift:265:15:265:31 | call to signum() |
107-
| test.swift:266:15:266:16 | ...? : | file://:0:0:0:0 | [summary param] this in signum() : |
108-
| test.swift:266:15:266:16 | ...? : | test.swift:266:15:266:25 | call to signum() : |
109-
| test.swift:266:15:266:25 | call to signum() : | test.swift:266:15:266:25 | OptionalEvaluationExpr |
110-
| test.swift:277:14:277:26 | (...) [Tuple element at index 1] : | test.swift:281:15:281:15 | t1 [Tuple element at index 1] : |
111-
| test.swift:277:18:277:25 | call to source() : | test.swift:277:14:277:26 | (...) [Tuple element at index 1] : |
112-
| test.swift:281:15:281:15 | t1 [Tuple element at index 1] : | test.swift:281:15:281:18 | .1 |
113-
| test.swift:289:5:289:5 | [post] t1 [Tuple element at index 0] : | test.swift:292:15:292:15 | t1 [Tuple element at index 0] : |
114-
| test.swift:289:12:289:19 | call to source() : | test.swift:289:5:289:5 | [post] t1 [Tuple element at index 0] : |
115-
| test.swift:292:15:292:15 | t1 [Tuple element at index 0] : | test.swift:292:15:292:18 | .0 |
116-
| test.swift:297:14:297:45 | (...) [Tuple element at index 0] : | test.swift:302:15:302:15 | t1 [Tuple element at index 0] : |
117-
| test.swift:297:14:297:45 | (...) [Tuple element at index 0] : | test.swift:306:15:306:15 | t2 [Tuple element at index 0] : |
118-
| test.swift:297:14:297:45 | (...) [Tuple element at index 1] : | test.swift:303:15:303:15 | t1 [Tuple element at index 1] : |
119-
| test.swift:297:14:297:45 | (...) [Tuple element at index 1] : | test.swift:307:15:307:15 | t2 [Tuple element at index 1] : |
120-
| test.swift:297:18:297:25 | call to source() : | test.swift:297:14:297:45 | (...) [Tuple element at index 0] : |
121-
| test.swift:297:31:297:38 | call to source() : | test.swift:297:14:297:45 | (...) [Tuple element at index 1] : |
122-
| test.swift:302:15:302:15 | t1 [Tuple element at index 0] : | test.swift:302:15:302:18 | .0 |
123-
| test.swift:303:15:303:15 | t1 [Tuple element at index 1] : | test.swift:303:15:303:18 | .1 |
124-
| test.swift:306:15:306:15 | t2 [Tuple element at index 0] : | test.swift:306:15:306:18 | .0 |
125-
| test.swift:307:15:307:15 | t2 [Tuple element at index 1] : | test.swift:307:15:307:18 | .1 |
103+
| test.swift:263:13:263:28 | call to optionalSource() : | test.swift:265:15:265:15 | x |
104+
| test.swift:263:13:263:28 | call to optionalSource() : | test.swift:267:15:267:16 | ...! |
105+
| test.swift:263:13:263:28 | call to optionalSource() : | test.swift:271:15:271:16 | ...? : |
106+
| test.swift:270:15:270:22 | call to source() : | file://:0:0:0:0 | [summary param] this in signum() : |
107+
| test.swift:270:15:270:22 | call to source() : | test.swift:270:15:270:31 | call to signum() |
108+
| test.swift:271:15:271:16 | ...? : | file://:0:0:0:0 | [summary param] this in signum() : |
109+
| test.swift:271:15:271:16 | ...? : | test.swift:271:15:271:25 | call to signum() : |
110+
| test.swift:271:15:271:25 | call to signum() : | test.swift:271:15:271:25 | OptionalEvaluationExpr |
111+
| test.swift:302:14:302:26 | (...) [Tuple element at index 1] : | test.swift:306:15:306:15 | t1 [Tuple element at index 1] : |
112+
| test.swift:302:18:302:25 | call to source() : | test.swift:302:14:302:26 | (...) [Tuple element at index 1] : |
113+
| test.swift:306:15:306:15 | t1 [Tuple element at index 1] : | test.swift:306:15:306:18 | .1 |
114+
| test.swift:314:5:314:5 | [post] t1 [Tuple element at index 0] : | test.swift:317:15:317:15 | t1 [Tuple element at index 0] : |
115+
| test.swift:314:12:314:19 | call to source() : | test.swift:314:5:314:5 | [post] t1 [Tuple element at index 0] : |
116+
| test.swift:317:15:317:15 | t1 [Tuple element at index 0] : | test.swift:317:15:317:18 | .0 |
117+
| test.swift:322:14:322:45 | (...) [Tuple element at index 0] : | test.swift:327:15:327:15 | t1 [Tuple element at index 0] : |
118+
| test.swift:322:14:322:45 | (...) [Tuple element at index 0] : | test.swift:331:15:331:15 | t2 [Tuple element at index 0] : |
119+
| test.swift:322:14:322:45 | (...) [Tuple element at index 1] : | test.swift:328:15:328:15 | t1 [Tuple element at index 1] : |
120+
| test.swift:322:14:322:45 | (...) [Tuple element at index 1] : | test.swift:332:15:332:15 | t2 [Tuple element at index 1] : |
121+
| test.swift:322:18:322:25 | call to source() : | test.swift:322:14:322:45 | (...) [Tuple element at index 0] : |
122+
| test.swift:322:31:322:38 | call to source() : | test.swift:322:14:322:45 | (...) [Tuple element at index 1] : |
123+
| test.swift:327:15:327:15 | t1 [Tuple element at index 0] : | test.swift:327:15:327:18 | .0 |
124+
| test.swift:328:15:328:15 | t1 [Tuple element at index 1] : | test.swift:328:15:328:18 | .1 |
125+
| test.swift:331:15:331:15 | t2 [Tuple element at index 0] : | test.swift:331:15:331:18 | .0 |
126+
| test.swift:332:15:332:15 | t2 [Tuple element at index 1] : | test.swift:332:15:332:18 | .1 |
126127
nodes
127128
| file://:0:0:0:0 | .a [x] : | semmle.label | .a [x] : |
128129
| file://:0:0:0:0 | .x : | semmle.label | .x : |
@@ -237,32 +238,33 @@ nodes
237238
| test.swift:238:13:238:15 | .source_value | semmle.label | .source_value |
238239
| test.swift:259:12:259:19 | call to source() : | semmle.label | call to source() : |
239240
| test.swift:263:13:263:28 | call to optionalSource() : | semmle.label | call to optionalSource() : |
240-
| test.swift:264:15:264:16 | ...! | semmle.label | ...! |
241-
| test.swift:265:15:265:22 | call to source() : | semmle.label | call to source() : |
242-
| test.swift:265:15:265:31 | call to signum() | semmle.label | call to signum() |
243-
| test.swift:266:15:266:16 | ...? : | semmle.label | ...? : |
244-
| test.swift:266:15:266:25 | OptionalEvaluationExpr | semmle.label | OptionalEvaluationExpr |
245-
| test.swift:266:15:266:25 | call to signum() : | semmle.label | call to signum() : |
246-
| test.swift:277:14:277:26 | (...) [Tuple element at index 1] : | semmle.label | (...) [Tuple element at index 1] : |
247-
| test.swift:277:18:277:25 | call to source() : | semmle.label | call to source() : |
248-
| test.swift:281:15:281:15 | t1 [Tuple element at index 1] : | semmle.label | t1 [Tuple element at index 1] : |
249-
| test.swift:281:15:281:18 | .1 | semmle.label | .1 |
250-
| test.swift:289:5:289:5 | [post] t1 [Tuple element at index 0] : | semmle.label | [post] t1 [Tuple element at index 0] : |
251-
| test.swift:289:12:289:19 | call to source() : | semmle.label | call to source() : |
252-
| test.swift:292:15:292:15 | t1 [Tuple element at index 0] : | semmle.label | t1 [Tuple element at index 0] : |
253-
| test.swift:292:15:292:18 | .0 | semmle.label | .0 |
254-
| test.swift:297:14:297:45 | (...) [Tuple element at index 0] : | semmle.label | (...) [Tuple element at index 0] : |
255-
| test.swift:297:14:297:45 | (...) [Tuple element at index 1] : | semmle.label | (...) [Tuple element at index 1] : |
256-
| test.swift:297:18:297:25 | call to source() : | semmle.label | call to source() : |
257-
| test.swift:297:31:297:38 | call to source() : | semmle.label | call to source() : |
258-
| test.swift:302:15:302:15 | t1 [Tuple element at index 0] : | semmle.label | t1 [Tuple element at index 0] : |
259-
| test.swift:302:15:302:18 | .0 | semmle.label | .0 |
260-
| test.swift:303:15:303:15 | t1 [Tuple element at index 1] : | semmle.label | t1 [Tuple element at index 1] : |
261-
| test.swift:303:15:303:18 | .1 | semmle.label | .1 |
262-
| test.swift:306:15:306:15 | t2 [Tuple element at index 0] : | semmle.label | t2 [Tuple element at index 0] : |
263-
| test.swift:306:15:306:18 | .0 | semmle.label | .0 |
264-
| test.swift:307:15:307:15 | t2 [Tuple element at index 1] : | semmle.label | t2 [Tuple element at index 1] : |
265-
| test.swift:307:15:307:18 | .1 | semmle.label | .1 |
241+
| test.swift:265:15:265:15 | x | semmle.label | x |
242+
| test.swift:267:15:267:16 | ...! | semmle.label | ...! |
243+
| test.swift:270:15:270:22 | call to source() : | semmle.label | call to source() : |
244+
| test.swift:270:15:270:31 | call to signum() | semmle.label | call to signum() |
245+
| test.swift:271:15:271:16 | ...? : | semmle.label | ...? : |
246+
| test.swift:271:15:271:25 | OptionalEvaluationExpr | semmle.label | OptionalEvaluationExpr |
247+
| test.swift:271:15:271:25 | call to signum() : | semmle.label | call to signum() : |
248+
| test.swift:302:14:302:26 | (...) [Tuple element at index 1] : | semmle.label | (...) [Tuple element at index 1] : |
249+
| test.swift:302:18:302:25 | call to source() : | semmle.label | call to source() : |
250+
| test.swift:306:15:306:15 | t1 [Tuple element at index 1] : | semmle.label | t1 [Tuple element at index 1] : |
251+
| test.swift:306:15:306:18 | .1 | semmle.label | .1 |
252+
| test.swift:314:5:314:5 | [post] t1 [Tuple element at index 0] : | semmle.label | [post] t1 [Tuple element at index 0] : |
253+
| test.swift:314:12:314:19 | call to source() : | semmle.label | call to source() : |
254+
| test.swift:317:15:317:15 | t1 [Tuple element at index 0] : | semmle.label | t1 [Tuple element at index 0] : |
255+
| test.swift:317:15:317:18 | .0 | semmle.label | .0 |
256+
| test.swift:322:14:322:45 | (...) [Tuple element at index 0] : | semmle.label | (...) [Tuple element at index 0] : |
257+
| test.swift:322:14:322:45 | (...) [Tuple element at index 1] : | semmle.label | (...) [Tuple element at index 1] : |
258+
| test.swift:322:18:322:25 | call to source() : | semmle.label | call to source() : |
259+
| test.swift:322:31:322:38 | call to source() : | semmle.label | call to source() : |
260+
| test.swift:327:15:327:15 | t1 [Tuple element at index 0] : | semmle.label | t1 [Tuple element at index 0] : |
261+
| test.swift:327:15:327:18 | .0 | semmle.label | .0 |
262+
| test.swift:328:15:328:15 | t1 [Tuple element at index 1] : | semmle.label | t1 [Tuple element at index 1] : |
263+
| test.swift:328:15:328:18 | .1 | semmle.label | .1 |
264+
| test.swift:331:15:331:15 | t2 [Tuple element at index 0] : | semmle.label | t2 [Tuple element at index 0] : |
265+
| test.swift:331:15:331:18 | .0 | semmle.label | .0 |
266+
| test.swift:332:15:332:15 | t2 [Tuple element at index 1] : | semmle.label | t2 [Tuple element at index 1] : |
267+
| test.swift:332:15:332:18 | .1 | semmle.label | .1 |
266268
subpaths
267269
| 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] &... : |
268270
| 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 ... : |
@@ -289,8 +291,8 @@ subpaths
289291
| test.swift:218:11:218:18 | call to source() : | test.swift:169:12:169:22 | value : | test.swift:170:5:170:5 | [post] self [x] : | test.swift:218:3:218:5 | [post] getter for .a [x] : |
290292
| test.swift:219:13:219:13 | b [a, x] : | test.swift:185:7:185:7 | self [a, x] : | file://:0:0:0:0 | .a [x] : | test.swift:219:13:219:15 | .a [x] : |
291293
| test.swift:219:13:219:15 | .a [x] : | test.swift:163:7:163:7 | self [x] : | file://:0:0:0:0 | .x : | test.swift:219:13:219:17 | .x |
292-
| test.swift:265:15:265:22 | call to source() : | file://:0:0:0:0 | [summary param] this in signum() : | file://:0:0:0:0 | [summary] to write: return (return) in signum() : | test.swift:265:15:265:31 | call to signum() |
293-
| test.swift:266:15:266:16 | ...? : | file://:0:0:0:0 | [summary param] this in signum() : | file://:0:0:0:0 | [summary] to write: return (return) in signum() : | test.swift:266:15:266:25 | call to signum() : |
294+
| test.swift:270:15:270:22 | call to source() : | file://:0:0:0:0 | [summary param] this in signum() : | file://:0:0:0:0 | [summary] to write: return (return) in signum() : | test.swift:270:15:270:31 | call to signum() |
295+
| test.swift:271:15:271:16 | ...? : | file://:0:0:0:0 | [summary param] this in signum() : | file://:0:0:0:0 | [summary] to write: return (return) in signum() : | test.swift:271:15:271:25 | call to signum() : |
294296
#select
295297
| test.swift:7:15:7:15 | t1 | test.swift:6:19:6:26 | call to source() : | test.swift:7:15:7:15 | t1 | result |
296298
| test.swift:9:15:9:15 | t1 | test.swift:6:19:6:26 | call to source() : | test.swift:9:15:9:15 | t1 | result |
@@ -320,12 +322,13 @@ subpaths
320322
| test.swift:219:13:219:17 | .x | test.swift:218:11:218:18 | call to source() : | test.swift:219:13:219:17 | .x | result |
321323
| test.swift:235:13:235:15 | .source_value | test.swift:225:14:225:21 | call to source() : | test.swift:235:13:235:15 | .source_value | result |
322324
| test.swift:238:13:238:15 | .source_value | test.swift:225:14:225:21 | call to source() : | test.swift:238:13:238:15 | .source_value | result |
323-
| test.swift:264:15:264:16 | ...! | test.swift:259:12:259:19 | call to source() : | test.swift:264:15:264:16 | ...! | result |
324-
| test.swift:265:15:265:31 | call to signum() | test.swift:265:15:265:22 | call to source() : | test.swift:265:15:265:31 | call to signum() | result |
325-
| test.swift:266:15:266:25 | OptionalEvaluationExpr | test.swift:259:12:259:19 | call to source() : | test.swift:266:15:266:25 | OptionalEvaluationExpr | result |
326-
| test.swift:281:15:281:18 | .1 | test.swift:277:18:277:25 | call to source() : | test.swift:281:15:281:18 | .1 | result |
327-
| test.swift:292:15:292:18 | .0 | test.swift:289:12:289:19 | call to source() : | test.swift:292:15:292:18 | .0 | result |
328-
| test.swift:302:15:302:18 | .0 | test.swift:297:18:297:25 | call to source() : | test.swift:302:15:302:18 | .0 | result |
329-
| test.swift:303:15:303:18 | .1 | test.swift:297:31:297:38 | call to source() : | test.swift:303:15:303:18 | .1 | result |
330-
| test.swift:306:15:306:18 | .0 | test.swift:297:18:297:25 | call to source() : | test.swift:306:15:306:18 | .0 | result |
331-
| test.swift:307:15:307:18 | .1 | test.swift:297:31:297:38 | call to source() : | test.swift:307:15:307:18 | .1 | result |
325+
| test.swift:265:15:265:15 | x | test.swift:259:12:259:19 | call to source() : | test.swift:265:15:265:15 | x | result |
326+
| test.swift:267:15:267:16 | ...! | test.swift:259:12:259:19 | call to source() : | test.swift:267:15:267:16 | ...! | result |
327+
| test.swift:270:15:270:31 | call to signum() | test.swift:270:15:270:22 | call to source() : | test.swift:270:15:270:31 | call to signum() | result |
328+
| test.swift:271:15:271:25 | OptionalEvaluationExpr | test.swift:259:12:259:19 | call to source() : | test.swift:271:15:271:25 | OptionalEvaluationExpr | result |
329+
| test.swift:306:15:306:18 | .1 | test.swift:302:18:302:25 | call to source() : | test.swift:306:15:306:18 | .1 | result |
330+
| test.swift:317:15:317:18 | .0 | test.swift:314:12:314:19 | call to source() : | test.swift:317:15:317:18 | .0 | result |
331+
| test.swift:327:15:327:18 | .0 | test.swift:322:18:322:25 | call to source() : | test.swift:327:15:327:18 | .0 | result |
332+
| test.swift:328:15:328:18 | .1 | test.swift:322:31:322:38 | call to source() : | test.swift:328:15:328:18 | .1 | result |
333+
| test.swift:331:15:331:18 | .0 | test.swift:322:18:322:25 | call to source() : | test.swift:331:15:331:18 | .0 | result |
334+
| test.swift:332:15:332:18 | .1 | test.swift:322:31:322:38 | call to source() : | test.swift:332:15:332:18 | .1 | result |

0 commit comments

Comments
 (0)