diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index 0daeb0c4ddb45..5c7079e3c245e 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -3056,7 +3056,7 @@ ERROR(duplicate_inheritance,none, WARNING(duplicate_anyobject_class_inheritance,none, "redundant inheritance from 'AnyObject' and Swift 3 'class' keyword", ()) ERROR(inheritance_from_protocol_with_superclass,none, - "inheritance from class-constrained protocol composition type %0", (Type)) + "cannot inherit from class-constrained protocol composition type %0", (Type)) WARNING(anyobject_class_inheritance_deprecated,Deprecation, "using 'class' keyword to define a class-constrained protocol is deprecated; " "use 'AnyObject' instead", ()) @@ -3065,7 +3065,7 @@ ERROR(multiple_inheritance,none, ERROR(inheritance_from_non_protocol_or_class,none, "inheritance from non-protocol, non-class type %0", (Type)) ERROR(inheritance_from_non_protocol,none, - "inheritance from non-protocol type %0", (Type)) + "cannot inherit from non-protocol type %0", (Type)) ERROR(inheritance_from_anyobject,none, "only protocols can inherit from 'AnyObject'", ()) ERROR(inheritance_from_parameterized_protocol,none, diff --git a/test/Generics/inheritance.swift b/test/Generics/inheritance.swift index ebfd77736f1d5..9226c91524df0 100644 --- a/test/Generics/inheritance.swift +++ b/test/Generics/inheritance.swift @@ -55,7 +55,7 @@ func testGenericInherit() { } -struct SS : T { } // expected-error{{inheritance from non-protocol type 'T'}} +struct SS : T { } // expected-error{{cannot inherit from non-protocol type 'T'}} enum SE : T { case X } // expected-error{{raw type 'T' is not expressible by a string, integer, or floating-point literal}} // expected-error {{SE' declares raw type 'T', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-error{{RawRepresentable conformance cannot be synthesized because raw type 'T' is not Equatable}} // Also need Equatable for init?(RawValue) diff --git a/test/Sema/moveonly_restrictions.swift b/test/Sema/moveonly_restrictions.swift index b77e22c482c1c..2de1ae0061207 100644 --- a/test/Sema/moveonly_restrictions.swift +++ b/test/Sema/moveonly_restrictions.swift @@ -185,7 +185,7 @@ extension ProtocolCheckMoveOnlyEnum : Any {} extension ProtocolCheckMoveOnlyEnum : AnyHashable {} // expected-error@-1 {{move-only enum 'ProtocolCheckMoveOnlyEnum' cannot conform to 'AnyHashable'}} -// expected-error@-2 {{inheritance from non-protocol type 'AnyHashable'}} +// expected-error@-2 {{cannot inherit from non-protocol type 'AnyHashable'}} // But a normal extension is ok. extension ProtocolCheckMoveOnlyKlass {} diff --git a/test/decl/enum/enumtest.swift b/test/decl/enum/enumtest.swift index 6f7d02e597998..b870ec87952dc 100644 --- a/test/decl/enum/enumtest.swift +++ b/test/decl/enum/enumtest.swift @@ -446,7 +446,7 @@ class C {} protocol P {} enum E : C & P {} -// expected-error@-1 {{inheritance from class-constrained protocol composition type 'C & P'}} +// expected-error@-1 {{cannot inherit from class-constrained protocol composition type 'C & P'}} // https://github.com/apple/swift/issues/53923 diff --git a/test/decl/inherit/inherit.swift b/test/decl/inherit/inherit.swift index c97a04e3ec41c..c1a3557b7694d 100644 --- a/test/decl/inherit/inherit.swift +++ b/test/decl/inherit/inherit.swift @@ -30,13 +30,13 @@ class D3 : Any, A { } // expected-error{{superclass 'A' must appear first in the class D4 : P & P1, A { } // expected-error{{superclass 'A' must appear first in the inheritance clause}}{{18-21=}}{{12-12=A, }} // Struct inheriting a class -struct S : A { } // expected-error{{inheritance from non-protocol type 'A'}} +struct S : A { } // expected-error{{cannot inherit from non-protocol type 'A'}} // Protocol inheriting a class protocol Q : A { } // Extension inheriting a class -extension C : A { } // expected-error{{inheritance from non-protocol type 'A'}} +extension C : A { } // expected-error{{cannot inherit from non-protocol type 'A'}} // Keywords in inheritance clauses struct S2 : struct { } // expected-error{{expected type}} diff --git a/test/decl/protocol/protocol_with_superclass_objc.swift b/test/decl/protocol/protocol_with_superclass_objc.swift index 1d5a20d507789..3d59ac9c785c0 100644 --- a/test/decl/protocol/protocol_with_superclass_objc.swift +++ b/test/decl/protocol/protocol_with_superclass_objc.swift @@ -3,14 +3,14 @@ class Base {} @objc protocol Protocol1 : Base {} -// expected-error@-1 {{inheritance from non-protocol type 'Base'}} +// expected-error@-1 {{cannot inherit from non-protocol type 'Base'}} @objc protocol OtherProtocol {} typealias Composition = OtherProtocol & Base @objc protocol Protocol2 : Composition {} -// expected-error@-1 {{inheritance from class-constrained protocol composition type 'Composition' (aka 'Base & OtherProtocol')}} +// expected-error@-1 {{cannot inherit from class-constrained protocol composition type 'Composition' (aka 'Base & OtherProtocol')}} @objc protocol Protocol3 : OtherProtocol & Base {} -// expected-error@-1 {{inheritance from class-constrained protocol composition type 'Base & OtherProtocol'}} +// expected-error@-1 {{cannot inherit from class-constrained protocol composition type 'Base & OtherProtocol'}} diff --git a/test/type/explicit_existential.swift b/test/type/explicit_existential.swift index e4693ec1f2c4d..af9a3c0e20100 100644 --- a/test/type/explicit_existential.swift +++ b/test/type/explicit_existential.swift @@ -255,7 +255,7 @@ func testExistentialAlias(x: Existential, y: any Constraint) {} // Reject explicit existential types in inheritance clauses protocol Empty {} -struct S : any Empty {} // expected-error {{inheritance from non-protocol type 'any Empty'}} +struct S : any Empty {} // expected-error {{cannot inherit from non-protocol type 'any Empty'}} class C : any Empty {} // expected-error {{inheritance from non-protocol, non-class type 'any Empty'}} // FIXME: Diagnostics are not great in the enum case because we confuse this with a raw type @@ -353,4 +353,4 @@ var example1: any (any IteratorProtocol) = 5 // expected-error{{redundant 'any' protocol PP {} struct A : PP {} let _: any PP = A() // Ok -let _: any (any PP) = A() // expected-error{{redundant 'any' in type 'any (any PP)'}} {{8-12=}} \ No newline at end of file +let _: any (any PP) = A() // expected-error{{redundant 'any' in type 'any (any PP)'}} {{8-12=}} diff --git a/test/type/explicit_existential_swift6.swift b/test/type/explicit_existential_swift6.swift index 8e28dd8dc72f2..ce317bb4dc55a 100644 --- a/test/type/explicit_existential_swift6.swift +++ b/test/type/explicit_existential_swift6.swift @@ -285,7 +285,7 @@ func testExistentialAlias(x: Existential, y: any Constraint) {} // Reject explicit existential types in inheritance clauses protocol Empty {} -struct S : any Empty {} // expected-error {{inheritance from non-protocol type 'any Empty'}} +struct S : any Empty {} // expected-error {{cannot inherit from non-protocol type 'any Empty'}} class C : any Empty {} // expected-error {{inheritance from non-protocol, non-class type 'any Empty'}} // FIXME: Diagnostics are not great in the enum case because we confuse this with a raw type diff --git a/test/type/implicit_some/explicit_existential.swift b/test/type/implicit_some/explicit_existential.swift index 0355b29a254ac..9a04481efcca8 100644 --- a/test/type/implicit_some/explicit_existential.swift +++ b/test/type/implicit_some/explicit_existential.swift @@ -225,7 +225,7 @@ func testExistentialAlias(x: Existential, y: any Constraint) {} // Reject explicit existential types in inheritance clauses protocol Empty {} -struct S : any Empty {} // expected-error {{inheritance from non-protocol type 'any Empty'}} +struct S : any Empty {} // expected-error {{cannot inherit from non-protocol type 'any Empty'}} class C : any Empty {} // expected-error {{inheritance from non-protocol, non-class type 'any Empty'}} // FIXME: Diagnostics are not great in the enum case because we confuse this with a raw type