Skip to content

Commit 2823e35

Browse files
authored
Merge pull request #11513 from rudkx/add-even-more-type-checker-perf-tests
More type checker performance tests.
2 parents ef0355b + 45eaffb commit 2823e35

File tree

9 files changed

+98
-0
lines changed

9 files changed

+98
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %scale-test --begin 3 --end 6 --step 1 --select incrementScopeCounter %s
2+
// REQUIRES: OS=macosx
3+
// REQUIRES: asserts
4+
5+
let _ = [
6+
%for i in range(0, N):
7+
["key1" : "value", "key2" : "value"],
8+
%end
9+
]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1
2+
// REQUIRES: tools-release,no_asserts
3+
4+
let _ = Array([0].lazy.reversed().filter { $0 % 2 == 0 }.map { $0 / 2 })
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %scale-test --begin 1 --end 5 --step 1 --select incrementScopeCounter %s
2+
// REQUIRES: OS=macosx
3+
// REQUIRES: asserts
4+
5+
enum E: UInt {
6+
%for i in range(0, N):
7+
case C${i}
8+
%end
9+
}
10+
11+
_ = [
12+
%for i in range(0, N):
13+
E.C${i}: [${i}],
14+
%end
15+
]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1
2+
// REQUIRES: tools-release,no_asserts
3+
4+
protocol P {
5+
associatedtype A
6+
static func fn(args: A)
7+
}
8+
9+
class R<T> : P where T : P, T.A == T.Type {
10+
// expected-note@-1 {{'T' declared as parameter to type 'R'}}
11+
typealias A = T.Type
12+
static func fn(args: T.Type) {}
13+
}
14+
15+
R.fn(args: R.self)
16+
// expected-error@-1 {{generic parameter 'T' could not be inferred}}
17+
// expected-note@-2 {{explicitly specify the generic arguments to fix this issue}}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: not %scale-test --begin 1 --end 3 --step 1 --select incrementScopeCounter %s
2+
// REQUIRES: OS=macosx
3+
// REQUIRES: asserts
4+
5+
let a = [[0]]
6+
_ = a[0][0]
7+
%for i in range(0, N):
8+
+ a[0][0]
9+
%end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: not %scale-test --begin 1 --end 3 --step 1 --select incrementScopeCounter %s
2+
// REQUIRES: OS=macosx
3+
// REQUIRES: asserts
4+
5+
typealias D = [String: Any]
6+
7+
_ = [
8+
%for i in range(0, N):
9+
"first": D(),
10+
"second": ["key": "value"],
11+
"third": ["key": D()],
12+
%end
13+
]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: not %scale-test --begin 1 --end 3 --step 1 --select incrementScopeCounter %s
2+
// REQUIRES: OS=macosx
3+
// REQUIRES: asserts
4+
5+
private let _: [Any?] = [[
6+
%for i in range(0, N):
7+
"A": [
8+
"B" : "C",
9+
%end
10+
%for i in range(0, N):
11+
]
12+
%end
13+
]]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: not %scale-test --begin 1 --end 3 --step 1 --select incrementScopeCounter %s
2+
// REQUIRES: OS=macosx
3+
// REQUIRES: asserts
4+
5+
let _ = [
6+
%for i in range(0, N):
7+
0..<1,
8+
%end
9+
]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1
2+
// REQUIRES: tools-release,no_asserts
3+
4+
let _ = (0...1).lazy.flatMap {
5+
a in (1...2).lazy.map { b in (a, b) }
6+
}.filter {
7+
// expected-error@-1 {{expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions}}
8+
1 < $0 && $0 < $1 && $0 + $1 < 3
9+
}

0 commit comments

Comments
 (0)