Skip to content

More type checker performance tests. #11513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// RUN: %scale-test --begin 3 --end 6 --step 1 --select incrementScopeCounter %s
// REQUIRES: OS=macosx
// REQUIRES: asserts

let _ = [
%for i in range(0, N):
["key1" : "value", "key2" : "value"],
%end
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1
// REQUIRES: tools-release,no_asserts

let _ = Array([0].lazy.reversed().filter { $0 % 2 == 0 }.map { $0 / 2 })
15 changes: 15 additions & 0 deletions validation-test/Sema/type_checker_perf/fast/rdar21070413.swift.gyb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// RUN: %scale-test --begin 1 --end 5 --step 1 --select incrementScopeCounter %s
// REQUIRES: OS=macosx
// REQUIRES: asserts

enum E: UInt {
%for i in range(0, N):
case C${i}
%end
}

_ = [
%for i in range(0, N):
E.C${i}: [${i}],
%end
]
17 changes: 17 additions & 0 deletions validation-test/Sema/type_checker_perf/fast/rdar21374729.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1
// REQUIRES: tools-release,no_asserts

protocol P {
associatedtype A
static func fn(args: A)
}

class R<T> : P where T : P, T.A == T.Type {
// expected-note@-1 {{'T' declared as parameter to type 'R'}}
typealias A = T.Type
static func fn(args: T.Type) {}
}

R.fn(args: R.self)
// expected-error@-1 {{generic parameter 'T' could not be inferred}}
// expected-note@-2 {{explicitly specify the generic arguments to fix this issue}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// RUN: not %scale-test --begin 1 --end 3 --step 1 --select incrementScopeCounter %s
// REQUIRES: OS=macosx
// REQUIRES: asserts

let a = [[0]]
_ = a[0][0]
%for i in range(0, N):
+ a[0][0]
%end
13 changes: 13 additions & 0 deletions validation-test/Sema/type_checker_perf/slow/rdar20818064.swift.gyb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: not %scale-test --begin 1 --end 3 --step 1 --select incrementScopeCounter %s
// REQUIRES: OS=macosx
// REQUIRES: asserts

typealias D = [String: Any]

_ = [
%for i in range(0, N):
"first": D(),
"second": ["key": "value"],
"third": ["key": D()],
%end
]
13 changes: 13 additions & 0 deletions validation-test/Sema/type_checker_perf/slow/rdar21198787.swift.gyb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: not %scale-test --begin 1 --end 3 --step 1 --select incrementScopeCounter %s
// REQUIRES: OS=macosx
// REQUIRES: asserts

private let _: [Any?] = [[
%for i in range(0, N):
"A": [
"B" : "C",
%end
%for i in range(0, N):
]
%end
]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// RUN: not %scale-test --begin 1 --end 3 --step 1 --select incrementScopeCounter %s
// REQUIRES: OS=macosx
// REQUIRES: asserts

let _ = [
%for i in range(0, N):
0..<1,
%end
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1
// REQUIRES: tools-release,no_asserts

let _ = (0...1).lazy.flatMap {
a in (1...2).lazy.map { b in (a, b) }
}.filter {
// expected-error@-1 {{expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions}}
1 < $0 && $0 < $1 && $0 + $1 < 3
}