Skip to content

Commit ea6c69d

Browse files
committed
Swift: fix test with different linux/macos results
`methodlookup.swift` has one more call to `Builtin.zeroInitializer()` in macOS than it does in Linux.
1 parent 40fb6f9 commit ea6c69d

File tree

2 files changed

+29
-48
lines changed

2 files changed

+29
-48
lines changed
Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,26 @@
11
noStaticTarget
22
#select
3-
| file://:0:0:0:0 | call to UnownedSerialExecutor.init(_:) | true | UnownedSerialExecutor.init(_:) |
4-
| file://:0:0:0:0 | call to buildDefaultActorExecutorRef(_:) | true | buildDefaultActorExecutorRef(_:) |
5-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
6-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
7-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
8-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
9-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
10-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
11-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
12-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
13-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
14-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
15-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
16-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
17-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
18-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
19-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
20-
| file://:0:0:0:0 | call to zeroInitializer() | true | zeroInitializer() |
21-
| methodlookup.swift:23:15:23:19 | call to Foo.init() | true | Foo.init() |
22-
| methodlookup.swift:24:9:24:18 | call to Foo.init() | true | Foo.init() |
23-
| methodlookup.swift:26:5:26:24 | call to instanceMethod() | true | instanceMethod() |
24-
| methodlookup.swift:27:5:27:27 | call to Foo.instanceMethod() | true | { ... } |
25-
| methodlookup.swift:27:5:27:29 | call to { ... } | true | { ... } |
26-
| methodlookup.swift:27:9:27:9 | call to instanceMethod() | true | instanceMethod() |
27-
| methodlookup.swift:29:5:29:21 | call to classMethod() | true | classMethod() |
28-
| methodlookup.swift:30:5:30:22 | call to staticMethod() | true | staticMethod() |
29-
| methodlookup.swift:33:1:41:1 | call to Task<Success, Never>.init(priority:operation:) | true | Task<Success, Never>.init(priority:operation:) |
30-
| methodlookup.swift:34:15:34:19 | call to Bar.init() | true | Bar.init() |
31-
| methodlookup.swift:35:9:35:18 | call to Bar.init() | true | Bar.init() |
32-
| methodlookup.swift:37:11:37:30 | call to instanceMethod() | true | instanceMethod() |
33-
| methodlookup.swift:40:5:40:22 | call to staticMethod() | true | staticMethod() |
34-
| methodlookup.swift:43:1:52:1 | call to Task<Success, Never>.init(priority:operation:) | true | Task<Success, Never>.init(priority:operation:) |
35-
| methodlookup.swift:44:21:44:25 | call to Baz.init() | true | Baz.init() |
36-
| methodlookup.swift:45:15:45:24 | call to Baz.init() | true | Baz.init() |
37-
| methodlookup.swift:47:11:47:30 | call to instanceMethod() | true | instanceMethod() |
38-
| methodlookup.swift:48:11:48:33 | call to Baz.instanceMethod() | true | { ... } |
39-
| methodlookup.swift:48:11:48:35 | call to { ... } | true | { ... } |
40-
| methodlookup.swift:48:15:48:15 | call to instanceMethod() | true | instanceMethod() |
41-
| methodlookup.swift:50:11:50:27 | call to classMethod() | true | classMethod() |
42-
| methodlookup.swift:51:11:51:28 | call to staticMethod() | true | staticMethod() |
3+
| file://:0:0:0:0 | call to UnownedSerialExecutor.init(_:) | true |
4+
| file://:0:0:0:0 | call to buildDefaultActorExecutorRef(_:) | true |
5+
| methodlookup.swift:23:15:23:19 | call to Foo.init() | true |
6+
| methodlookup.swift:24:9:24:18 | call to Foo.init() | true |
7+
| methodlookup.swift:26:5:26:24 | call to instanceMethod() | true |
8+
| methodlookup.swift:27:5:27:27 | call to Foo.instanceMethod() | true |
9+
| methodlookup.swift:27:5:27:29 | call to { ... } | true |
10+
| methodlookup.swift:27:9:27:9 | call to instanceMethod() | true |
11+
| methodlookup.swift:29:5:29:21 | call to classMethod() | true |
12+
| methodlookup.swift:30:5:30:22 | call to staticMethod() | true |
13+
| methodlookup.swift:33:1:41:1 | call to Task<Success, Never>.init(priority:operation:) | true |
14+
| methodlookup.swift:34:15:34:19 | call to Bar.init() | true |
15+
| methodlookup.swift:35:9:35:18 | call to Bar.init() | true |
16+
| methodlookup.swift:37:11:37:30 | call to instanceMethod() | true |
17+
| methodlookup.swift:40:5:40:22 | call to staticMethod() | true |
18+
| methodlookup.swift:43:1:52:1 | call to Task<Success, Never>.init(priority:operation:) | true |
19+
| methodlookup.swift:44:21:44:25 | call to Baz.init() | true |
20+
| methodlookup.swift:45:15:45:24 | call to Baz.init() | true |
21+
| methodlookup.swift:47:11:47:30 | call to instanceMethod() | true |
22+
| methodlookup.swift:48:11:48:33 | call to Baz.instanceMethod() | true |
23+
| methodlookup.swift:48:11:48:35 | call to { ... } | true |
24+
| methodlookup.swift:48:15:48:15 | call to instanceMethod() | true |
25+
| methodlookup.swift:50:11:50:27 | call to classMethod() | true |
26+
| methodlookup.swift:51:11:51:28 | call to staticMethod() | true |

swift/ql/test/library-tests/elements/expr/methodlookup/getStaticTarget.ql

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ query predicate noStaticTarget(CallExpr c, Expr func, string funcClass) {
66
funcClass = func.getPrimaryQlClasses()
77
}
88

9-
from CallExpr c, boolean hasStaticTarget, string staticTarget
9+
from CallExpr c, boolean hasStaticTarget
1010
where
1111
if exists(c.getStaticTarget().toString())
12-
then (
12+
then
1313
hasStaticTarget = true and
14-
staticTarget = c.getStaticTarget().toString()
15-
) else (
16-
hasStaticTarget = false and
17-
staticTarget = "-"
18-
)
19-
select c, hasStaticTarget, staticTarget
14+
not c.getStaticTarget().toString() = "zeroInitializer()" // Omit because a different number of these calls appear in linux and macos
15+
else hasStaticTarget = false
16+
select c, hasStaticTarget

0 commit comments

Comments
 (0)