Don't suggest adding 'as' in a pattern matching context where it will do no good.

This commit is contained in:
gregomni
2017-10-26 15:49:54 -07:00
parent cdce937c51
commit 55edab880f
2 changed files with 13 additions and 0 deletions

View File

@@ -53,6 +53,9 @@ func testAmbiguousStringComparisons(s: String) {
let a10 = nsString <= s // expected-error{{'NSString' is not implicitly convertible to 'String'; did you mean to use 'as' to explicitly convert?}} {{21-21= as String}}
let a11 = nsString >= s // expected-error{{'NSString' is not implicitly convertible to 'String'; did you mean to use 'as' to explicitly convert?}} {{21-21= as String}}
let a12 = nsString > s // expected-error{{'NSString' is not implicitly convertible to 'String'; did you mean to use 'as' to explicitly convert?}} {{21-21= as String}}
// Shouldn't suggest 'as' in a pattern-matching context, as opposed to all these other situations
if case nsString = "" {} // expected-error{{expression pattern of type 'NSString' cannot match values of type 'String'}}
}
func testStringDeprecation(hello: String) {