mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Swift: Add more tests.
This commit is contained in:
@@ -251,26 +251,31 @@ edges
|
||||
| test.swift:568:5:568:5 | [post] self [x] : | test.swift:567:3:569:3 | self[return] [x] : |
|
||||
| test.swift:568:14:568:14 | x : | test.swift:568:5:568:5 | [post] self [x] : |
|
||||
| test.swift:573:11:573:24 | call to S.init(x:) [x] : | test.swift:575:13:575:13 | s [x] : |
|
||||
| test.swift:573:11:573:24 | call to S.init(x:) [x] : | test.swift:578:13:578:13 | s [x] : |
|
||||
| test.swift:573:16:573:23 | call to source() : | test.swift:567:8:567:11 | x : |
|
||||
| test.swift:573:16:573:23 | call to source() : | test.swift:573:11:573:24 | call to S.init(x:) [x] : |
|
||||
| test.swift:574:11:574:14 | enter #keyPath(...) [x] : | test.swift:574:14:574:14 | KeyPathComponent [x] : |
|
||||
| test.swift:574:14:574:14 | KeyPathComponent [x] : | test.swift:574:11:574:14 | exit #keyPath(...) : |
|
||||
| test.swift:575:13:575:13 | s [x] : | test.swift:574:11:574:14 | enter #keyPath(...) [x] : |
|
||||
| test.swift:575:13:575:13 | s [x] : | test.swift:575:13:575:25 | \\...[...] |
|
||||
| test.swift:581:8:581:11 | s [x] : | test.swift:582:14:582:14 | s [x] : |
|
||||
| test.swift:582:5:582:5 | [post] self [s, x] : | test.swift:581:3:583:3 | self[return] [s, x] : |
|
||||
| test.swift:582:14:582:14 | s [x] : | test.swift:582:5:582:5 | [post] self [s, x] : |
|
||||
| test.swift:587:11:587:24 | call to S.init(x:) [x] : | test.swift:588:18:588:18 | s [x] : |
|
||||
| test.swift:587:16:587:23 | call to source() : | test.swift:567:8:567:11 | x : |
|
||||
| test.swift:587:16:587:23 | call to source() : | test.swift:587:11:587:24 | call to S.init(x:) [x] : |
|
||||
| test.swift:588:12:588:19 | call to S2.init(s:) [s, x] : | test.swift:590:13:590:13 | s2 [s, x] : |
|
||||
| test.swift:588:18:588:18 | s [x] : | test.swift:581:8:581:11 | s [x] : |
|
||||
| test.swift:588:18:588:18 | s [x] : | test.swift:588:12:588:19 | call to S2.init(s:) [s, x] : |
|
||||
| test.swift:589:11:589:17 | enter #keyPath(...) [s, x] : | test.swift:589:15:589:15 | KeyPathComponent [s, x] : |
|
||||
| test.swift:589:15:589:15 | KeyPathComponent [s, x] : | test.swift:589:17:589:17 | KeyPathComponent [x] : |
|
||||
| test.swift:589:17:589:17 | KeyPathComponent [x] : | test.swift:589:11:589:17 | exit #keyPath(...) : |
|
||||
| test.swift:590:13:590:13 | s2 [s, x] : | test.swift:589:11:589:17 | enter #keyPath(...) [s, x] : |
|
||||
| test.swift:590:13:590:13 | s2 [s, x] : | test.swift:590:13:590:26 | \\...[...] |
|
||||
| test.swift:577:36:577:38 | enter #keyPath(...) [x] : | test.swift:577:38:577:38 | KeyPathComponent [x] : |
|
||||
| test.swift:577:38:577:38 | KeyPathComponent [x] : | test.swift:577:36:577:38 | exit #keyPath(...) : |
|
||||
| test.swift:578:13:578:13 | s [x] : | test.swift:577:36:577:38 | enter #keyPath(...) [x] : |
|
||||
| test.swift:578:13:578:13 | s [x] : | test.swift:578:13:578:32 | \\...[...] |
|
||||
| test.swift:584:8:584:11 | s [x] : | test.swift:585:14:585:14 | s [x] : |
|
||||
| test.swift:585:5:585:5 | [post] self [s, x] : | test.swift:584:3:586:3 | self[return] [s, x] : |
|
||||
| test.swift:585:14:585:14 | s [x] : | test.swift:585:5:585:5 | [post] self [s, x] : |
|
||||
| test.swift:590:11:590:24 | call to S.init(x:) [x] : | test.swift:591:18:591:18 | s [x] : |
|
||||
| test.swift:590:16:590:23 | call to source() : | test.swift:567:8:567:11 | x : |
|
||||
| test.swift:590:16:590:23 | call to source() : | test.swift:590:11:590:24 | call to S.init(x:) [x] : |
|
||||
| test.swift:591:12:591:19 | call to S2.init(s:) [s, x] : | test.swift:593:13:593:13 | s2 [s, x] : |
|
||||
| test.swift:591:18:591:18 | s [x] : | test.swift:584:8:584:11 | s [x] : |
|
||||
| test.swift:591:18:591:18 | s [x] : | test.swift:591:12:591:19 | call to S2.init(s:) [s, x] : |
|
||||
| test.swift:592:11:592:17 | enter #keyPath(...) [s, x] : | test.swift:592:15:592:15 | KeyPathComponent [s, x] : |
|
||||
| test.swift:592:15:592:15 | KeyPathComponent [s, x] : | test.swift:592:17:592:17 | KeyPathComponent [x] : |
|
||||
| test.swift:592:17:592:17 | KeyPathComponent [x] : | test.swift:592:11:592:17 | exit #keyPath(...) : |
|
||||
| test.swift:593:13:593:13 | s2 [s, x] : | test.swift:592:11:592:17 | enter #keyPath(...) [s, x] : |
|
||||
| test.swift:593:13:593:13 | s2 [s, x] : | test.swift:593:13:593:26 | \\...[...] |
|
||||
nodes
|
||||
| file://:0:0:0:0 | .a [x] : | semmle.label | .a [x] : |
|
||||
| file://:0:0:0:0 | .str : | semmle.label | .str : |
|
||||
@@ -549,20 +554,25 @@ nodes
|
||||
| test.swift:574:14:574:14 | KeyPathComponent [x] : | semmle.label | KeyPathComponent [x] : |
|
||||
| test.swift:575:13:575:13 | s [x] : | semmle.label | s [x] : |
|
||||
| test.swift:575:13:575:25 | \\...[...] | semmle.label | \\...[...] |
|
||||
| test.swift:581:3:583:3 | self[return] [s, x] : | semmle.label | self[return] [s, x] : |
|
||||
| test.swift:581:8:581:11 | s [x] : | semmle.label | s [x] : |
|
||||
| test.swift:582:5:582:5 | [post] self [s, x] : | semmle.label | [post] self [s, x] : |
|
||||
| test.swift:582:14:582:14 | s [x] : | semmle.label | s [x] : |
|
||||
| test.swift:587:11:587:24 | call to S.init(x:) [x] : | semmle.label | call to S.init(x:) [x] : |
|
||||
| test.swift:587:16:587:23 | call to source() : | semmle.label | call to source() : |
|
||||
| test.swift:588:12:588:19 | call to S2.init(s:) [s, x] : | semmle.label | call to S2.init(s:) [s, x] : |
|
||||
| test.swift:588:18:588:18 | s [x] : | semmle.label | s [x] : |
|
||||
| test.swift:589:11:589:17 | enter #keyPath(...) [s, x] : | semmle.label | enter #keyPath(...) [s, x] : |
|
||||
| test.swift:589:11:589:17 | exit #keyPath(...) : | semmle.label | exit #keyPath(...) : |
|
||||
| test.swift:589:15:589:15 | KeyPathComponent [s, x] : | semmle.label | KeyPathComponent [s, x] : |
|
||||
| test.swift:589:17:589:17 | KeyPathComponent [x] : | semmle.label | KeyPathComponent [x] : |
|
||||
| test.swift:590:13:590:13 | s2 [s, x] : | semmle.label | s2 [s, x] : |
|
||||
| test.swift:590:13:590:26 | \\...[...] | semmle.label | \\...[...] |
|
||||
| test.swift:577:36:577:38 | enter #keyPath(...) [x] : | semmle.label | enter #keyPath(...) [x] : |
|
||||
| test.swift:577:36:577:38 | exit #keyPath(...) : | semmle.label | exit #keyPath(...) : |
|
||||
| test.swift:577:38:577:38 | KeyPathComponent [x] : | semmle.label | KeyPathComponent [x] : |
|
||||
| test.swift:578:13:578:13 | s [x] : | semmle.label | s [x] : |
|
||||
| test.swift:578:13:578:32 | \\...[...] | semmle.label | \\...[...] |
|
||||
| test.swift:584:3:586:3 | self[return] [s, x] : | semmle.label | self[return] [s, x] : |
|
||||
| test.swift:584:8:584:11 | s [x] : | semmle.label | s [x] : |
|
||||
| test.swift:585:5:585:5 | [post] self [s, x] : | semmle.label | [post] self [s, x] : |
|
||||
| test.swift:585:14:585:14 | s [x] : | semmle.label | s [x] : |
|
||||
| test.swift:590:11:590:24 | call to S.init(x:) [x] : | semmle.label | call to S.init(x:) [x] : |
|
||||
| test.swift:590:16:590:23 | call to source() : | semmle.label | call to source() : |
|
||||
| test.swift:591:12:591:19 | call to S2.init(s:) [s, x] : | semmle.label | call to S2.init(s:) [s, x] : |
|
||||
| test.swift:591:18:591:18 | s [x] : | semmle.label | s [x] : |
|
||||
| test.swift:592:11:592:17 | enter #keyPath(...) [s, x] : | semmle.label | enter #keyPath(...) [s, x] : |
|
||||
| test.swift:592:11:592:17 | exit #keyPath(...) : | semmle.label | exit #keyPath(...) : |
|
||||
| test.swift:592:15:592:15 | KeyPathComponent [s, x] : | semmle.label | KeyPathComponent [s, x] : |
|
||||
| test.swift:592:17:592:17 | KeyPathComponent [x] : | semmle.label | KeyPathComponent [x] : |
|
||||
| test.swift:593:13:593:13 | s2 [s, x] : | semmle.label | s2 [s, x] : |
|
||||
| test.swift:593:13:593:26 | \\...[...] | semmle.label | \\...[...] |
|
||||
subpaths
|
||||
| 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] &... : |
|
||||
| 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 ... : |
|
||||
@@ -602,9 +612,10 @@ subpaths
|
||||
| test.swift:550:13:550:41 | call to Self.init(contentsOfFile:) [str] : | test.swift:535:9:535:9 | self [str] : | file://:0:0:0:0 | .str : | test.swift:550:13:550:43 | .str |
|
||||
| test.swift:573:16:573:23 | call to source() : | test.swift:567:8:567:11 | x : | test.swift:567:3:569:3 | self[return] [x] : | test.swift:573:11:573:24 | call to S.init(x:) [x] : |
|
||||
| test.swift:575:13:575:13 | s [x] : | test.swift:574:11:574:14 | enter #keyPath(...) [x] : | test.swift:574:11:574:14 | exit #keyPath(...) : | test.swift:575:13:575:25 | \\...[...] |
|
||||
| test.swift:587:16:587:23 | call to source() : | test.swift:567:8:567:11 | x : | test.swift:567:3:569:3 | self[return] [x] : | test.swift:587:11:587:24 | call to S.init(x:) [x] : |
|
||||
| test.swift:588:18:588:18 | s [x] : | test.swift:581:8:581:11 | s [x] : | test.swift:581:3:583:3 | self[return] [s, x] : | test.swift:588:12:588:19 | call to S2.init(s:) [s, x] : |
|
||||
| test.swift:590:13:590:13 | s2 [s, x] : | test.swift:589:11:589:17 | enter #keyPath(...) [s, x] : | test.swift:589:11:589:17 | exit #keyPath(...) : | test.swift:590:13:590:26 | \\...[...] |
|
||||
| test.swift:578:13:578:13 | s [x] : | test.swift:577:36:577:38 | enter #keyPath(...) [x] : | test.swift:577:36:577:38 | exit #keyPath(...) : | test.swift:578:13:578:32 | \\...[...] |
|
||||
| test.swift:590:16:590:23 | call to source() : | test.swift:567:8:567:11 | x : | test.swift:567:3:569:3 | self[return] [x] : | test.swift:590:11:590:24 | call to S.init(x:) [x] : |
|
||||
| test.swift:591:18:591:18 | s [x] : | test.swift:584:8:584:11 | s [x] : | test.swift:584:3:586:3 | self[return] [s, x] : | test.swift:591:12:591:19 | call to S2.init(s:) [s, x] : |
|
||||
| test.swift:593:13:593:13 | s2 [s, x] : | test.swift:592:11:592:17 | enter #keyPath(...) [s, x] : | test.swift:592:11:592:17 | exit #keyPath(...) : | test.swift:593:13:593:26 | \\...[...] |
|
||||
#select
|
||||
| test.swift:7:15:7:15 | t1 | test.swift:6:19:6:26 | call to source() : | test.swift:7:15:7:15 | t1 | result |
|
||||
| test.swift:9:15:9:15 | t1 | test.swift:6:19:6:26 | call to source() : | test.swift:9:15:9:15 | t1 | result |
|
||||
@@ -676,4 +687,5 @@ subpaths
|
||||
| test.swift:549:13:549:35 | .str | test.swift:549:24:549:32 | call to source3() : | test.swift:549:13:549:35 | .str | result |
|
||||
| test.swift:550:13:550:43 | .str | test.swift:543:20:543:28 | call to source3() : | test.swift:550:13:550:43 | .str | result |
|
||||
| test.swift:575:13:575:25 | \\...[...] | test.swift:573:16:573:23 | call to source() : | test.swift:575:13:575:25 | \\...[...] | result |
|
||||
| test.swift:590:13:590:26 | \\...[...] | test.swift:587:16:587:23 | call to source() : | test.swift:590:13:590:26 | \\...[...] | result |
|
||||
| test.swift:578:13:578:32 | \\...[...] | test.swift:573:16:573:23 | call to source() : | test.swift:578:13:578:32 | \\...[...] | result |
|
||||
| test.swift:593:13:593:26 | \\...[...] | test.swift:590:16:590:23 | call to source() : | test.swift:593:13:593:26 | \\...[...] | result |
|
||||
|
||||
@@ -615,20 +615,50 @@
|
||||
| test.swift:574:7:574:7 | f | test.swift:574:7:574:7 | SSA def(f) |
|
||||
| test.swift:574:11:574:14 | #keyPath(...) | test.swift:574:7:574:7 | f |
|
||||
| test.swift:574:11:574:14 | enter #keyPath(...) | test.swift:574:14:574:14 | KeyPathComponent |
|
||||
| test.swift:579:7:579:7 | self | test.swift:579:7:579:7 | SSA def(self) |
|
||||
| test.swift:581:3:581:3 | SSA def(self) | test.swift:582:5:582:5 | self |
|
||||
| test.swift:581:3:581:3 | self | test.swift:581:3:581:3 | SSA def(self) |
|
||||
| test.swift:581:8:581:11 | SSA def(s) | test.swift:582:14:582:14 | s |
|
||||
| test.swift:581:8:581:11 | s | test.swift:581:8:581:11 | SSA def(s) |
|
||||
| test.swift:582:5:582:5 | [post] self | test.swift:581:3:583:3 | self[return] |
|
||||
| test.swift:582:5:582:5 | self | test.swift:581:3:583:3 | self[return] |
|
||||
| test.swift:587:7:587:7 | SSA def(s) | test.swift:588:18:588:18 | s |
|
||||
| test.swift:587:7:587:7 | s | test.swift:587:7:587:7 | SSA def(s) |
|
||||
| test.swift:587:11:587:24 | call to S.init(x:) | test.swift:587:7:587:7 | s |
|
||||
| test.swift:588:7:588:7 | SSA def(s2) | test.swift:590:13:590:13 | s2 |
|
||||
| test.swift:588:7:588:7 | s2 | test.swift:588:7:588:7 | SSA def(s2) |
|
||||
| test.swift:588:12:588:19 | call to S2.init(s:) | test.swift:588:7:588:7 | s2 |
|
||||
| test.swift:589:7:589:7 | SSA def(f) | test.swift:590:25:590:25 | f |
|
||||
| test.swift:589:7:589:7 | f | test.swift:589:7:589:7 | SSA def(f) |
|
||||
| test.swift:589:11:589:17 | #keyPath(...) | test.swift:589:7:589:7 | f |
|
||||
| test.swift:589:11:589:17 | enter #keyPath(...) | test.swift:589:15:589:15 | KeyPathComponent |
|
||||
| test.swift:575:13:575:13 | s | test.swift:578:13:578:13 | s |
|
||||
| test.swift:577:7:577:7 | SSA def(inferred) | test.swift:578:24:578:24 | inferred |
|
||||
| test.swift:577:7:577:7 | inferred | test.swift:577:7:577:7 | SSA def(inferred) |
|
||||
| test.swift:577:7:577:32 | ... as ... | test.swift:577:7:577:7 | inferred |
|
||||
| test.swift:577:36:577:38 | #keyPath(...) | test.swift:577:7:577:32 | ... as ... |
|
||||
| test.swift:577:36:577:38 | enter #keyPath(...) | test.swift:577:38:577:38 | KeyPathComponent |
|
||||
| test.swift:582:7:582:7 | self | test.swift:582:7:582:7 | SSA def(self) |
|
||||
| test.swift:584:3:584:3 | SSA def(self) | test.swift:585:5:585:5 | self |
|
||||
| test.swift:584:3:584:3 | self | test.swift:584:3:584:3 | SSA def(self) |
|
||||
| test.swift:584:8:584:11 | SSA def(s) | test.swift:585:14:585:14 | s |
|
||||
| test.swift:584:8:584:11 | s | test.swift:584:8:584:11 | SSA def(s) |
|
||||
| test.swift:585:5:585:5 | [post] self | test.swift:584:3:586:3 | self[return] |
|
||||
| test.swift:585:5:585:5 | self | test.swift:584:3:586:3 | self[return] |
|
||||
| test.swift:590:7:590:7 | SSA def(s) | test.swift:591:18:591:18 | s |
|
||||
| test.swift:590:7:590:7 | s | test.swift:590:7:590:7 | SSA def(s) |
|
||||
| test.swift:590:11:590:24 | call to S.init(x:) | test.swift:590:7:590:7 | s |
|
||||
| test.swift:591:7:591:7 | SSA def(s2) | test.swift:593:13:593:13 | s2 |
|
||||
| test.swift:591:7:591:7 | s2 | test.swift:591:7:591:7 | SSA def(s2) |
|
||||
| test.swift:591:12:591:19 | call to S2.init(s:) | test.swift:591:7:591:7 | s2 |
|
||||
| test.swift:592:7:592:7 | SSA def(f) | test.swift:593:25:593:25 | f |
|
||||
| test.swift:592:7:592:7 | f | test.swift:592:7:592:7 | SSA def(f) |
|
||||
| test.swift:592:11:592:17 | #keyPath(...) | test.swift:592:7:592:7 | f |
|
||||
| test.swift:592:11:592:17 | enter #keyPath(...) | test.swift:592:15:592:15 | KeyPathComponent |
|
||||
| test.swift:597:9:597:9 | SSA def(array) | test.swift:599:15:599:15 | array |
|
||||
| test.swift:597:9:597:9 | array | test.swift:597:9:597:9 | SSA def(array) |
|
||||
| test.swift:597:17:597:26 | [...] | test.swift:597:9:597:9 | array |
|
||||
| test.swift:598:9:598:9 | SSA def(f) | test.swift:599:30:599:30 | f |
|
||||
| test.swift:598:9:598:9 | f | test.swift:598:9:598:9 | SSA def(f) |
|
||||
| test.swift:598:13:598:22 | #keyPath(...) | test.swift:598:9:598:9 | f |
|
||||
| test.swift:598:13:598:22 | enter #keyPath(...) | test.swift:598:20:598:22 | KeyPathComponent |
|
||||
| test.swift:603:7:603:7 | self | test.swift:603:7:603:7 | SSA def(self) |
|
||||
| test.swift:605:3:605:3 | SSA def(self) | test.swift:606:5:606:5 | self |
|
||||
| test.swift:605:3:605:3 | self | test.swift:605:3:605:3 | SSA def(self) |
|
||||
| test.swift:605:8:605:12 | SSA def(s) | test.swift:606:14:606:14 | s |
|
||||
| test.swift:605:8:605:12 | s | test.swift:605:8:605:12 | SSA def(s) |
|
||||
| test.swift:606:5:606:5 | [post] self | test.swift:605:3:607:3 | self[return] |
|
||||
| test.swift:606:5:606:5 | self | test.swift:605:3:607:3 | self[return] |
|
||||
| test.swift:611:9:611:9 | SSA def(s) | test.swift:612:29:612:29 | s |
|
||||
| test.swift:611:9:611:9 | s | test.swift:611:9:611:9 | SSA def(s) |
|
||||
| test.swift:611:13:611:26 | call to S.init(x:) | test.swift:611:9:611:9 | s |
|
||||
| test.swift:612:9:612:9 | SSA def(s2) | test.swift:614:15:614:15 | s2 |
|
||||
| test.swift:612:9:612:9 | s2 | test.swift:612:9:612:9 | SSA def(s2) |
|
||||
| test.swift:612:14:612:30 | call to S2_Optional.init(s:) | test.swift:612:9:612:9 | s2 |
|
||||
| test.swift:613:9:613:9 | SSA def(f) | test.swift:614:27:614:27 | f |
|
||||
| test.swift:613:9:613:9 | f | test.swift:613:9:613:9 | SSA def(f) |
|
||||
| test.swift:613:13:613:29 | #keyPath(...) | test.swift:613:9:613:9 | f |
|
||||
| test.swift:613:13:613:29 | enter #keyPath(...) | test.swift:613:26:613:26 | KeyPathComponent |
|
||||
|
||||
@@ -573,6 +573,9 @@ func testKeyPath() {
|
||||
let s = S(x: source())
|
||||
let f = \S.x
|
||||
sink(arg: s[keyPath: f]) // $ flow=573
|
||||
|
||||
let inferred : KeyPath<S, Int> = \.x
|
||||
sink(arg: s[keyPath: inferred]) // $ flow=573
|
||||
}
|
||||
|
||||
struct S2 {
|
||||
@@ -587,5 +590,26 @@ func testNestedKeyPath() {
|
||||
let s = S(x: source())
|
||||
let s2 = S2(s: s)
|
||||
let f = \S2.s.x
|
||||
sink(arg: s2[keyPath: f]) // $ flow=587
|
||||
sink(arg: s2[keyPath: f]) // $ flow=590
|
||||
}
|
||||
|
||||
func testArrayKeyPath() {
|
||||
let array = [source()]
|
||||
let f = \[Int].[0]
|
||||
sink(arg: array[keyPath: f]) // $ MISSING: flow=597
|
||||
}
|
||||
|
||||
struct S2_Optional {
|
||||
let s: S?
|
||||
|
||||
init(s: S?) {
|
||||
self.s = s
|
||||
}
|
||||
}
|
||||
|
||||
func testOptionalKeyPath() {
|
||||
let s = S(x: source())
|
||||
let s2 = S2_Optional(s: s)
|
||||
let f = \S2_Optional.s?.x
|
||||
sink(opt: s2[keyPath: f]) // $ MISSING: flow=611
|
||||
}
|
||||
Reference in New Issue
Block a user