Skip to content

Commit 9797069

Browse files
authored
Merge pull request #10070 from github/redsun82/swift-self-apply-tests
Swift: add more `SelfApplyExpr` testing
2 parents 9e0c82e + f17fed7 commit 9797069

12 files changed

+79
-10
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| constructor_ref_calls.swift:7:9:7:9 | call to init | getFunction: | constructor_ref_calls.swift:7:9:7:9 | init | getBaseExpr: | constructor_ref_calls.swift:7:9:7:9 | X.Type |
2+
| constructor_ref_calls.swift:8:10:8:10 | call to init | getFunction: | constructor_ref_calls.swift:8:10:8:10 | init | getBaseExpr: | constructor_ref_calls.swift:8:10:8:10 | Y.Type |
3+
| constructor_ref_calls.swift:9:10:9:10 | call to init | getFunction: | constructor_ref_calls.swift:9:10:9:10 | init | getBaseExpr: | constructor_ref_calls.swift:9:10:9:10 | Y.Type |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// generated by codegen/codegen.py
2+
import codeql.swift.elements
3+
import TestUtils
4+
5+
from ConstructorRefCallExpr x, Expr getFunction, Expr getBaseExpr
6+
where
7+
toBeTested(x) and
8+
not x.isUnknown() and
9+
getFunction = x.getFunction() and
10+
getBaseExpr = x.getBaseExpr()
11+
select x, "getFunction:", getFunction, "getBaseExpr:", getBaseExpr
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| constructor_ref_calls.swift:7:9:7:9 | call to init | 0 | constructor_ref_calls.swift:7:9:7:9 | : X.Type |
2+
| constructor_ref_calls.swift:8:10:8:10 | call to init | 0 | constructor_ref_calls.swift:8:10:8:10 | : Y.Type |
3+
| constructor_ref_calls.swift:9:10:9:10 | call to init | 0 | constructor_ref_calls.swift:9:10:9:10 | : Y.Type |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// generated by codegen/codegen.py
2+
import codeql.swift.elements
3+
import TestUtils
4+
5+
from ConstructorRefCallExpr x, int index
6+
where toBeTested(x) and not x.isUnknown()
7+
select x, index, x.getArgument(index)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| constructor_ref_calls.swift:7:9:7:9 | call to init | () -> X |
2+
| constructor_ref_calls.swift:8:10:8:10 | call to init | (Int) -> Y |
3+
| constructor_ref_calls.swift:9:10:9:10 | call to init | () -> Y |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// generated by codegen/codegen.py
2+
import codeql.swift.elements
3+
import TestUtils
4+
5+
from ConstructorRefCallExpr x
6+
where toBeTested(x) and not x.isUnknown()
7+
select x, x.getType()

swift/ql/test/extractor-tests/generated/expr/ConstructorRefCallExpr/MISSING_SOURCE.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
struct X {}
2+
struct Y {
3+
init() {}
4+
init(_: Int) {}
5+
}
6+
7+
let x = X()
8+
let y1 = Y(42)
9+
let y2 = Y()
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
| dot_syntax_call.swift:6:1:6:3 | call to foo(_:_:) | getFunction: | dot_syntax_call.swift:6:3:6:3 | foo(_:_:) | getBaseExpr: | dot_syntax_call.swift:6:1:6:1 | X.Type |
2-
| dot_syntax_call.swift:7:1:7:3 | call to bar() | getFunction: | dot_syntax_call.swift:7:3:7:3 | bar() | getBaseExpr: | dot_syntax_call.swift:7:1:7:1 | X.Type |
1+
| dot_syntax_call.swift:7:13:7:13 | call to ... | getFunction: | dot_syntax_call.swift:7:13:7:13 | { ... } | getBaseExpr: | dot_syntax_call.swift:7:13:7:13 | self |
2+
| dot_syntax_call.swift:7:13:7:13 | call to baz(_:) | getFunction: | dot_syntax_call.swift:7:13:7:13 | baz(_:) | getBaseExpr: | file://:0:0:0:0 | self |
3+
| dot_syntax_call.swift:11:1:11:3 | call to foo(_:_:) | getFunction: | dot_syntax_call.swift:11:3:11:3 | foo(_:_:) | getBaseExpr: | dot_syntax_call.swift:11:1:11:1 | X.Type |
4+
| dot_syntax_call.swift:12:1:12:3 | call to bar() | getFunction: | dot_syntax_call.swift:12:3:12:3 | bar() | getBaseExpr: | dot_syntax_call.swift:12:1:12:1 | X.Type |
5+
| dot_syntax_call.swift:13:1:13:5 | call to baz(_:) | getFunction: | dot_syntax_call.swift:13:5:13:5 | baz(_:) | getBaseExpr: | dot_syntax_call.swift:13:1:13:3 | call to ... |
6+
| dot_syntax_call.swift:15:9:15:11 | call to ... | getFunction: | dot_syntax_call.swift:15:11:15:11 | { ... } | getBaseExpr: | dot_syntax_call.swift:15:9:15:9 | X.Type |
7+
| dot_syntax_call.swift:15:11:15:11 | call to bar() | getFunction: | dot_syntax_call.swift:15:11:15:11 | bar() | getBaseExpr: | file://:0:0:0:0 | self |
8+
| dot_syntax_call.swift:16:9:16:13 | call to ... | getFunction: | dot_syntax_call.swift:16:13:16:13 | { ... } | getBaseExpr: | dot_syntax_call.swift:16:9:16:11 | call to ... |
9+
| dot_syntax_call.swift:16:13:16:13 | call to baz(_:) | getFunction: | dot_syntax_call.swift:16:13:16:13 | baz(_:) | getBaseExpr: | file://:0:0:0:0 | self |
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
| dot_syntax_call.swift:6:1:6:3 | call to foo(_:_:) | 0 | dot_syntax_call.swift:6:1:6:1 | : X.Type |
2-
| dot_syntax_call.swift:7:1:7:3 | call to bar() | 0 | dot_syntax_call.swift:7:1:7:1 | : X.Type |
1+
| dot_syntax_call.swift:7:13:7:13 | call to ... | 0 | dot_syntax_call.swift:7:13:7:13 | : self |
2+
| dot_syntax_call.swift:7:13:7:13 | call to baz(_:) | 0 | file://:0:0:0:0 | : self |
3+
| dot_syntax_call.swift:11:1:11:3 | call to foo(_:_:) | 0 | dot_syntax_call.swift:11:1:11:1 | : X.Type |
4+
| dot_syntax_call.swift:12:1:12:3 | call to bar() | 0 | dot_syntax_call.swift:12:1:12:1 | : X.Type |
5+
| dot_syntax_call.swift:13:1:13:5 | call to baz(_:) | 0 | dot_syntax_call.swift:13:1:13:3 | : call to ... |
6+
| dot_syntax_call.swift:15:9:15:11 | call to ... | 0 | dot_syntax_call.swift:15:9:15:9 | : X.Type |
7+
| dot_syntax_call.swift:15:11:15:11 | call to bar() | 0 | file://:0:0:0:0 | : self |
8+
| dot_syntax_call.swift:16:9:16:13 | call to ... | 0 | dot_syntax_call.swift:16:9:16:11 | : call to ... |
9+
| dot_syntax_call.swift:16:13:16:13 | call to baz(_:) | 0 | file://:0:0:0:0 | : self |

0 commit comments

Comments
 (0)