Skip to content

Commit 7ce37dd

Browse files
committed
[TypeChecker] NFC: Adjust test-cases improved by changes in binding inference
1 parent a49353b commit 7ce37dd

File tree

6 files changed

+7
-14
lines changed

6 files changed

+7
-14
lines changed

test/Constraints/array_literal.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ useDoubleList([1.0,2,3])
5050
useDoubleList([1.0,2.0,3.0])
5151

5252
useIntDict(["Niners" => 31, "Ravens" => 34])
53-
useIntDict(["Niners" => 31, "Ravens" => 34.0]) // expected-error{{cannot convert value of type 'Double' to expected argument type 'Int'}}
53+
useIntDict(["Niners" => 31, "Ravens" => 34.0]) // expected-error{{cannot convert value of type 'Double' to expected element type 'Int'}}
5454
// <rdar://problem/22333090> QoI: Propagate contextual information in a call to operands
5555
useDoubleDict(["Niners" => 31, "Ravens" => 34.0])
5656
useDoubleDict(["Niners" => 31.0, "Ravens" => 34])
@@ -328,7 +328,6 @@ protocol P { }
328328
struct PArray<T> { }
329329

330330
extension PArray : ExpressibleByArrayLiteral where T: P {
331-
// expected-note@-1 {{requirement from conditional conformance of 'PArray<String>' to 'ExpressibleByArrayLiteral'}}
332331
typealias ArrayLiteralElement = T
333332

334333
init(arrayLiteral elements: T...) { }
@@ -338,7 +337,7 @@ extension Int: P { }
338337

339338
func testConditional(i: Int, s: String) {
340339
let _: PArray<Int> = [i, i, i]
341-
let _: PArray<String> = [s, s, s] // expected-error{{generic struct 'PArray' requires that 'String' conform to 'P'}}
340+
let _: PArray<String> = [s, s, s] // expected-error{{cannot convert value of type '[String]' to specified type 'PArray<String>'}}
342341
}
343342

344343

test/Constraints/closures.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,7 @@ extension Collection {
456456
}
457457
}
458458
func fn_r28909024(n: Int) {
459-
// FIXME(diagnostics): Unfortunately there is no easy way to fix this diagnostic issue at the moment
460-
// because the problem is related to ordering of the bindings - we'd attempt to bind result of the expression
461-
// to contextual type of `Void` which prevents solver from discovering correct types for range - 0..<10
462-
// (since both arguments are literal they are ranked lower than contextual type).
463-
//
464-
// Good diagnostic for this is - `unexpected non-void return value in void function`
465-
return (0..<10).r28909024 { // expected-error {{type of expression is ambiguous without more context}}
459+
return (0..<10).r28909024 { // expected-error {{unexpected non-void return value in void function}} // expected-note {{did you mean to add a return type?}}
466460
_ in true
467461
}
468462
}

test/Parse/omit_return.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ var fvs_stubMyOwnFatalError: () {
10051005
var fvs_forceTryExplicit: String {
10061006
get { "ok" }
10071007
set {
1008-
return try! failableIdentity("shucks") // expected-error {{cannot convert value of type 'String' to expected argument type '()'}}
1008+
return try! failableIdentity("shucks") // expected-error {{unexpected non-void return value in void function}}
10091009
}
10101010
}
10111011

test/attr/attr_dynamic_member_lookup.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ func keypath_with_subscripts(_ arr: SubscriptLens<[Int]>,
600600

601601
func keypath_with_incorrect_return_type(_ arr: Lens<Array<Int>>) {
602602
for idx in 0..<arr.count {
603-
// expected-error@-1 {{cannot convert value of type 'Int' to expected argument type 'Lens<Int>'}}
603+
// expected-error@-1 {{cannot convert value of type 'Lens<Int>' to expected argument type 'Int'}}
604604
let _ = arr[idx]
605605
}
606606
}

test/decl/typealias/generic.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ _ = A<String, Int>(a: "foo", // expected-error {{cannot convert value of type 'S
103103
b: 42) // expected-error {{cannot convert value of type 'Int' to expected argument type 'String'}}
104104
_ = B(a: 12, b: 42)
105105
_ = B(a: 12, b: 42 as Float)
106-
_ = B(a: "foo", b: 42) // expected-error {{cannot convert value of type 'Int' to expected argument type 'String'}}
106+
_ = B(a: "foo", b: 42) // expected-error {{conflicting arguments to generic parameter 'T1' ('String' vs. 'Int')}}
107107
_ = C(a: "foo", b: 42)
108108
_ = C(a: 42, // expected-error {{cannot convert value of type 'Int' to expected argument type 'String'}}
109109
b: 42)

test/expr/expressions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ func testNilCoalescePrecedence(cond: Bool, a: Int?, r: ClosedRange<Int>?) {
790790

791791
// ?? should have lower precedence than range and arithmetic operators.
792792
let r1 = r ?? (0...42) // ok
793-
let r2 = (r ?? 0)...42 // not ok: expected-error 2 {{cannot convert value of type 'Int' to expected argument type 'ClosedRange<Int>'}}
793+
let r2 = (r ?? 0)...42 // not ok: expected-error {{binary operator '??' cannot be applied to operands of type 'ClosedRange<Int>?' and 'Int'}}
794794
let r3 = r ?? 0...42 // parses as the first one, not the second.
795795

796796

0 commit comments

Comments
 (0)