Skip to content

Commit dee02c4

Browse files
committed
Update test cases for constraint solver performance hack
1 parent 3d32e89 commit dee02c4

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

test/Compatibility/enum_cases.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ enum G_E<T> {
1919
let arr: [String] = []
2020
let _ = arr.map(E.foo) // Ok
2121
let _ = arr.map(E.bar) // Ok
22-
let _ = arr.map(E.two) // expected-error {{cannot convert value of type '(Int, Int) -> E' to expected argument type '(String) -> _'}}
23-
let _ = arr.map(E.tuple) // expected-error {{cannot convert value of type '((x: Int, y: Int)) -> E' to expected argument type '(String) -> _'}}
22+
let _ = arr.map(E.two) // expected-error {{cannot invoke 'map' with an argument list of type '((Int, Int) -> E)'}}
23+
// expected-note@-1{{expected an argument list of type '((Self.Element) throws -> T)'}}
24+
let _ = arr.map(E.tuple) // expected-error {{cannot invoke 'map' with an argument list of type '(((x: Int, y: Int)) -> E)'}}
25+
// expected-note@-1{{expected an argument list of type '((Self.Element) throws -> T)'}}
2426

2527
let _ = arr.map(G_E<String>.foo) // Ok
2628
let _ = arr.map(G_E<String>.bar) // Ok
27-
let _ = arr.map(G_E<String>.two) // expected-error {{cannot convert value of type '(String, String) -> G_E<String>' to expected argument type '(String) -> _'}}
28-
let _ = arr.map(G_E<Int>.tuple) // expected-error {{cannot convert value of type '((x: Int, y: Int)) -> G_E<Int>' to expected argument type '(String) -> _'}}
29+
let _ = arr.map(G_E<String>.two) // expected-error {{cannot invoke 'map' with an argument list of type '((String, String) -> G_E<String>)'}}
30+
// expected-note@-1{{expected an argument list of type '((Self.Element) throws -> T)'}}
31+
32+
let _ = arr.map(G_E<Int>.tuple) // expected-error {{cannot invoke 'map' with an argument list of type '(((x: Int, y: Int)) -> G_E<Int>)'}}
33+
// expected-note@-1{{expected an argument list of type '((Self.Element) throws -> T)'}}
2934

3035
let _ = E.foo("hello") // expected-error {{missing argument label 'bar:' in call}}
3136
let _ = E.bar("hello") // Ok

test/Constraints/enum_cases.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ enum G_E<T> {
1919
let arr: [String] = []
2020
let _ = arr.map(E.foo) // Ok
2121
let _ = arr.map(E.bar) // Ok
22-
let _ = arr.map(E.two) // expected-error {{cannot convert value of type '(Int, Int) -> E' to expected argument type '(String) -> _'}}
23-
let _ = arr.map(E.tuple) // expected-error {{cannot convert value of type '((x: Int, y: Int)) -> E' to expected argument type '(String) -> _'}}
22+
let _ = arr.map(E.two) // expected-error {{cannot invoke 'map' with an argument list of type '((Int, Int) -> E)'}}
23+
// expected-note@-1{{expected an argument list of type '((Self.Element) throws -> T)'}}
24+
25+
let _ = arr.map(E.tuple) // expected-error {{cannot invoke 'map' with an argument list of type '(((x: Int, y: Int)) -> E)'}}
26+
// expected-note@-1{{expected an argument list of type '((Self.Element) throws -> T)'}}
2427

2528
let _ = arr.map(G_E<String>.foo) // Ok
2629
let _ = arr.map(G_E<String>.bar) // Ok
27-
let _ = arr.map(G_E<String>.two) // expected-error {{cannot convert value of type '(String, String) -> G_E<String>' to expected argument type '(String) -> _'}}
28-
let _ = arr.map(G_E<Int>.tuple) // expected-error {{cannot convert value of type '((x: Int, y: Int)) -> G_E<Int>' to expected argument type '(String) -> _'}}
30+
let _ = arr.map(G_E<String>.two) // expected-error {{cannot invoke 'map' with an argument list of type '((String, String) -> G_E<String>)'}}
31+
// expected-note@-1{{expected an argument list of type '((Self.Element) throws -> T)'}}
32+
let _ = arr.map(G_E<Int>.tuple) // expected-error {{cannot invoke 'map' with an argument list of type '(((x: Int, y: Int)) -> G_E<Int>)'}}
33+
// expected-note@-1{{expected an argument list of type '((Self.Element) throws -> T)'}}
2934

3035
let _ = E.foo("hello") // expected-error {{missing argument label 'bar:' in call}}
3136
let _ = E.bar("hello") // Ok

test/Constraints/optional.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,22 @@ func test8(_ x : AnyObject?) {
8181

8282

8383
// Partial ordering with optionals
84-
func test9_helper<T>(_ x: T) -> Int { }
85-
func test9_helper<T>(_ x: T?) -> Double { }
84+
func test9_helper<T: P>(_ x: T) -> Int { }
85+
func test9_helper<T: P>(_ x: T?) -> Double { }
86+
87+
func test9_helper2<T>(_ x: T) -> Int { }
88+
func test9_helper2<T>(_ x: T?) -> Double { }
8689

8790
func test9(_ i: Int, io: Int?) {
8891
let result = test9_helper(i)
8992
var _: Int = result
9093
let result2 = test9_helper(io)
9194
let _: Double = result2
95+
96+
let result3 = test9_helper2(i)
97+
var _: Double = result3
98+
let result4 = test9_helper2(io)
99+
let _: Double = result4
92100
}
93101

94102
protocol P { }
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1
22
// REQUIRES: tools-release,no_asserts
33

4+
// expected-no-diagnostics
5+
46
let a: [Double] = []
57
_ = a.map { $0 - 1.0 }
6-
// expected-error@-1 {{expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions}}
78
.map { $0 * $0 }
89
.reduce(0, +) / Double(a.count)

0 commit comments

Comments
 (0)