diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index bc42105b4ac18..63dbe7f1ea7d8 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -1108,7 +1108,7 @@ WARNING(conditional_downcast_same_type,none, "bridging conversion; did you mean to use 'as'?}2", (Type, Type, unsigned)) WARNING(is_expr_same_type,none, - "checking a value with optional type %0 against dynamic type %1 " + "checking a value with optional type %0 against type %1 " "succeeds whenever the value is non-nil; did you mean to use " "'!= nil'?", (Type, Type)) WARNING(downcast_to_unrelated,none, diff --git a/test/Constraints/bridging.swift b/test/Constraints/bridging.swift index aa81c84539699..3825993193dc6 100644 --- a/test/Constraints/bridging.swift +++ b/test/Constraints/bridging.swift @@ -401,7 +401,7 @@ func SR15161_as(e: Error?) { } func SR15161_is(e: Error?) { - _ = e is NSError // expected-warning{{checking a value with optional type 'Error?' against dynamic type 'NSError' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}} + _ = e is NSError // expected-warning{{checking a value with optional type 'Error?' against type 'NSError' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}} } func SR15161_as_1(e: Error?) { diff --git a/test/decl/protocol/protocols.swift b/test/decl/protocol/protocols.swift index 6689695102b62..89a12f2f7cf1f 100644 --- a/test/decl/protocol/protocols.swift +++ b/test/decl/protocol/protocols.swift @@ -443,8 +443,7 @@ func h(_ x : T) { } func i(_ x : T?) -> Bool { return x is P1 - // FIXME: Bogus diagnostic. See SR-11920. - // expected-warning@-2 {{checking a value with optional type 'T?' against dynamic type 'P1' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}} + // expected-warning@-1 {{checking a value with optional type 'T?' against type 'P1' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}} } func j(_ x : C1) -> Bool { return x is P1 diff --git a/test/expr/cast/bridged.swift b/test/expr/cast/bridged.swift index 6fc0329ba4f53..3d255c1686359 100644 --- a/test/expr/cast/bridged.swift +++ b/test/expr/cast/bridged.swift @@ -85,8 +85,8 @@ func testBridgeDowncastExact(_ obj: BridgedClass, objOpt: BridgedClass?, _ = objImplicitOpt as! BridgedStruct // expected-warning{{forced cast from 'BridgedClass?' to 'BridgedStruct' only unwraps and bridges; did you mean to use '!' with 'as'?}}{{21-21=!}}{{22-25=as}} _ = obj is BridgedStruct // expected-warning{{'is' test is always true}} - _ = objOpt is BridgedStruct // expected-warning{{checking a value with optional type 'BridgedClass?' against dynamic type 'BridgedStruct' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}}{{14-30=!= nil}} - _ = objImplicitOpt is BridgedStruct // expected-warning{{checking a value with optional type 'BridgedClass?' against dynamic type 'BridgedStruct' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}}{{22-38=!= nil}} + _ = objOpt is BridgedStruct // expected-warning{{checking a value with optional type 'BridgedClass?' against type 'BridgedStruct' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}}{{14-30=!= nil}} + _ = objImplicitOpt is BridgedStruct // expected-warning{{checking a value with optional type 'BridgedClass?' against type 'BridgedStruct' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}}{{22-38=!= nil}} } func testExplicitBridging(_ object: BridgedClass, value: BridgedStruct) { diff --git a/test/expr/cast/optional.swift b/test/expr/cast/optional.swift index 3e1571b8e1688..e5b9236720b86 100644 --- a/test/expr/cast/optional.swift +++ b/test/expr/cast/optional.swift @@ -26,8 +26,8 @@ func f1(i: Int?, ii: Int??, a: [Base]?, d: [Base : Base]?, de: Derived?) { _ = de as? Base // expected-warning{{conditional downcast from 'Derived?' to 'Base' is equivalent to an implicit conversion to an optional 'Base'}}{{9-18=}} // "is" checks - _ = i is Int // expected-warning{{checking a value with optional type 'Int?' against dynamic type 'Int' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}}{{9-15=!= nil}} - _ = i..<1 is Int // expected-warning{{checking a value with optional type 'Int?' against dynamic type 'Int' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}}{{7-7=(}}{{12-12=)}}{{13-19=!= nil}} + _ = i is Int // expected-warning{{checking a value with optional type 'Int?' against type 'Int' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}}{{9-15=!= nil}} + _ = i..<1 is Int // expected-warning{{checking a value with optional type 'Int?' against type 'Int' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}}{{7-7=(}}{{12-12=)}}{{13-19=!= nil}} _ = ii is Int _ = i..<1 is Bool // expected-warning{{cast from 'Int?' to unrelated type 'Bool' always fails}}