Skip to content

Commit d3f7369

Browse files
authored
Merge pull request #78304 from slavapestov/too-complex-tests
Add formerly-slow expressions found by building projects from the Swift package index
2 parents c879e3f + 8d0d957 commit d3f7369

File tree

5 files changed

+131
-0
lines changed

5 files changed

+131
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %target-swift-frontend -typecheck %s -solver-scope-threshold=1000
2+
// REQUIRES: tools-release,no_asan
3+
4+
public class Cookie {
5+
public var url: String!
6+
public var port: Int16?
7+
public var name: String!
8+
public var path: String!
9+
public var value: String!
10+
public var comment: String?
11+
public var commentURL: String?
12+
13+
private let fixedByteSize: Int32 = 56
14+
15+
var totalByteCount: Int32 {
16+
return fixedByteSize +
17+
(port != nil ? 2 : 0) +
18+
Int32(comment?.utf8.count ?? 0) +
19+
Int32(commentURL?.utf8.count ?? 0) +
20+
Int32(url.utf8.count) +
21+
Int32(name.utf8.count) +
22+
Int32(path.utf8.count) +
23+
Int32(value.utf8.count)
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %scale-test --begin 1 --end 10 --step 1 --select NumConstraintScopes %s
2+
// REQUIRES: tools-release,no_asan,asserts
3+
4+
var v: [String] = []
5+
var vv: [String]? = nil
6+
7+
func f() -> [String] {
8+
return (
9+
%for i in range(0, N):
10+
v +
11+
%end
12+
v + (vv ?? []))
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %target-swift-frontend -typecheck %s -solver-scope-threshold=50000
2+
// REQUIRES: tools-release,no_asan
3+
4+
extension String {
5+
func replacingOccurrences(of: String, with: String) -> String { return "" }
6+
func components(separatedBy: String) -> [String] { return [] }
7+
}
8+
9+
func getProperties(
10+
from ics: String
11+
) -> [(name: String, value: String)] {
12+
return ics
13+
.replacingOccurrences(of: "\r\n ", with: "")
14+
.components(separatedBy: "\r\n")
15+
.map { $0.split(separator: ":", maxSplits: 1, omittingEmptySubsequences: true) }
16+
.filter { $0.count > 1 }
17+
.map { (String($0[0]), String($0[1])) }
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// RUN: %target-swift-frontend -typecheck %s -solver-scope-threshold=60000
2+
// REQUIRES: tools-release,no_asan
3+
4+
protocol ArgumentProtocol {}
5+
6+
extension String: ArgumentProtocol {}
7+
extension Bool: ArgumentProtocol {}
8+
9+
struct ConcreteError: Error {}
10+
11+
struct Option<T> {
12+
init(key: String, defaultValue: T, usage: String) {}
13+
}
14+
15+
struct Argument<T> {
16+
init(defaultValue: T? = nil, usage: String, usageParameter: String? = nil) {}
17+
}
18+
19+
struct Switch {
20+
init(flag: Character? = nil, key: String, usage: String) {}
21+
}
22+
23+
infix operator <*> : LogicalDisjunctionPrecedence
24+
infix operator <| : MultiplicationPrecedence
25+
26+
func <*> <T, U>(f: (T) -> U, value: Result<T, ConcreteError>) -> Result<U, ConcreteError> { fatalError() }
27+
func <*> <T, U>(f: Result<((T) -> U), ConcreteError>, value: Result<T, ConcreteError>) -> Result<U, ConcreteError> { fatalError() }
28+
29+
struct CommandMode {
30+
static func <| <T: ArgumentProtocol>(mode: CommandMode, option: Option<T>) -> Result<T, ConcreteError> { fatalError() }
31+
static func <| <T: ArgumentProtocol>(mode: CommandMode, option: Option<T?>) -> Result<T?, ConcreteError> { fatalError() }
32+
static func <| <T: ArgumentProtocol>(mode: CommandMode, option: Option<[T]>) -> Result<[T], ConcreteError> { fatalError() }
33+
static func <| <T: ArgumentProtocol>(mode: CommandMode, option: Option<[T]?>) -> Result<[T]?, ConcreteError> { fatalError() }
34+
static func <| (mode: CommandMode, option: Option<Bool>) -> Result<Bool, ConcreteError> { fatalError() }
35+
static func <| (mode: CommandMode, option: Switch) -> Result<Bool, ConcreteError> { fatalError() }
36+
static func <| <T: ArgumentProtocol>(mode: CommandMode, argument: Argument<T>) -> Result<T, ConcreteError> { fatalError() }
37+
static func <| <T: ArgumentProtocol>(mode: CommandMode, argument: Argument<[T]>) -> Result<[T], ConcreteError> { fatalError() }
38+
}
39+
40+
struct FileManager {
41+
static var `default`: FileManager = FileManager()
42+
var currentDirectoryPath: String = ""
43+
}
44+
45+
struct Options {
46+
static func create(_ project: String?) -> (String?) -> (String) -> (String) -> (String?) -> (String?) -> (String?) -> (String?) -> (Bool) -> ([String]) -> Options { fatalError() }
47+
48+
static func evaluate(_ mode: CommandMode) -> Result<Options, ConcreteError> {
49+
let defaultBuildDirectory = ""
50+
return create
51+
<*> mode <| Option(key: "", defaultValue: nil, usage: "")
52+
<*> mode <| Option(key: "", defaultValue: nil, usage: "")
53+
<*> mode <| Option(key: "", defaultValue: FileManager.default.currentDirectoryPath, usage: "")
54+
<*> mode <| Option(key: "", defaultValue: FileManager.default.currentDirectoryPath, usage: "")
55+
<*> mode <| Option(key: "", defaultValue: nil, usage: "")
56+
<*> mode <| Option(key: "", defaultValue: nil, usage: "")
57+
<*> mode <| Option(key: "", defaultValue: nil, usage: "")
58+
<*> mode <| Option(key: "", defaultValue: nil, usage: "")
59+
<*> mode <| Switch(key: "", usage: "")
60+
<*> mode <| Argument(defaultValue: [], usage: "")
61+
}
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-swift-frontend -typecheck %s -solver-scope-threshold=1000 -swift-version 5
2+
// REQUIRES: tools-release,no_asan
3+
4+
func g<T>(_: T) throws {
5+
let _: T? =
6+
(try? f() as? T) ??
7+
(try? f() as? T) ??
8+
(try? f() as? T) ??
9+
(try? f() as? T) ??
10+
(try? f() as? T)
11+
}
12+
13+
func f() throws -> Int { return 0 }

0 commit comments

Comments
 (0)