Skip to content

Commit aad3bc6

Browse files
author
Aniket Ray
committed
Updated Tests for Diagnostics
1 parent b2007cf commit aad3bc6

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

test/Generics/inheritance.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func testGenericInherit() {
5555
}
5656

5757

58-
struct SS<T> : T { } // expected-error{{inheritance from non-protocol type 'T'}}
58+
struct SS<T> : T { } // expected-error{{generic struct type cannot inherit from non-protocol type 'T'giy }}
5959
enum SE<T> : T { case X } // expected-error{{raw type 'T' is not expressible by a string, integer, or floating-point literal}} // expected-error {{SE<T>' 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}}
6060

6161
// Also need Equatable for init?(RawValue)

test/Parse/diagnostic_missing_func_keyword.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class C1 {
5757
}
5858

5959
class C2 {
60-
class classProperty: Int { 0 } // expected-error {{inheritance from non-protocol, non-class type 'Int'}}
60+
class classProperty: Int { 0 } // expected-error {{class type cannot inherit from non-protocol, non-class type 'Int'}}
6161
// expected-note @-1 {{in declaration of 'classProperty'}}
6262
// expected-error @-2 {{expected declaration}}
6363
}

test/decl/inherit/inherit.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ class D3 : Any, A { } // expected-error{{superclass 'A' must appear first in the
3030
class D4 : P & P1, A { } // expected-error{{superclass 'A' must appear first in the inheritance clause}}{{18-21=}}{{12-12=A, }}
3131

3232
// Struct inheriting a class
33-
struct S : A { } // expected-error{{inheritance from non-protocol type 'A'}}
33+
struct S : A { } // expected-error{{struct type cannot inherit from non-protocol type 'A'}}
3434

3535
// Protocol inheriting a class
3636
protocol Q : A { }
3737

3838
// Extension inheriting a class
39-
extension C : A { } // expected-error{{inheritance from non-protocol type 'A'}}
39+
extension C : A { } // expected-error{{extension type cannot inherit from non-protocol type 'A'}}
4040

4141
// Keywords in inheritance clauses
4242
struct S2 : struct { } // expected-error{{expected type}}
@@ -56,7 +56,7 @@ class GenericBase<T> {}
5656

5757
class GenericSub<T> : GenericBase<T> {} // okay
5858

59-
class InheritGenericParam<T> : T {} // expected-error {{inheritance from non-protocol, non-class type 'T'}}
59+
class InheritGenericParam<T> : T {} // expected-error {{generic class type cannot inherit from non-protocol, non-class type 'T'}}
6060
class InheritBody : T { // expected-error {{cannot find type 'T' in scope}}
6161
typealias T = A
6262
}

test/decl/protocol/conforms/placement.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,20 @@ extension ExplicitSub1 : P1 { } // expected-error{{redundant conformance of 'Exp
105105
// ---------------------------------------------------------------------------
106106
// Suppression of synthesized conformances
107107
// ---------------------------------------------------------------------------
108-
class SynthesizedClass1 : AnyObject { } // expected-error{{inheritance from non-protocol, non-class type 'AnyObject'}}
108+
class SynthesizedClass1 : AnyObject { } // expected-error{{class type cannot inherit from non-protocol, non-class type 'AnyObject'}}
109109

110110
class SynthesizedClass2 { }
111-
extension SynthesizedClass2 : AnyObject { } // expected-error{{inheritance from non-protocol type 'AnyObject'}}
111+
extension SynthesizedClass2 : AnyObject { } // expected-error{{extension type cannot inherit from non-protocol type 'AnyObject'}}
112112

113113
class SynthesizedClass3 : AnyObjectRefinement { }
114114

115115
class SynthesizedClass4 { }
116116
extension SynthesizedClass4 : AnyObjectRefinement { }
117117

118-
class SynthesizedSubClass1 : SynthesizedClass1, AnyObject { } // expected-error{{inheritance from non-protocol, non-class type 'AnyObject'}}
118+
class SynthesizedSubClass1 : SynthesizedClass1, AnyObject { } // expected-error{{class type cannot inherit from non-protocol, non-class type 'AnyObject'}}
119119

120120
class SynthesizedSubClass2 : SynthesizedClass2 { }
121-
extension SynthesizedSubClass2 : AnyObject { } // expected-error{{inheritance from non-protocol type 'AnyObject'}}
121+
extension SynthesizedSubClass2 : AnyObject { } // expected-error{{extension type cannot inherit from non-protocol type 'AnyObject'}}
122122

123123
class SynthesizedSubClass3 : SynthesizedClass1, AnyObjectRefinement { }
124124

@@ -169,12 +169,12 @@ extension MFExplicitSub1 : P1 { } // expected-error{{redundant conformance of 'M
169169
// ---------------------------------------------------------------------------
170170
class MFSynthesizedClass1 { }
171171

172-
extension MFSynthesizedClass2 : AnyObject { } // expected-error{{inheritance from non-protocol type 'AnyObject'}}
172+
extension MFSynthesizedClass2 : AnyObject { } // expected-error{{extension type cannot inherit from non-protocol type 'AnyObject'}}
173173

174174
class MFSynthesizedClass4 { }
175175
extension MFSynthesizedClass4 : AnyObjectRefinement { }
176176

177-
extension MFSynthesizedSubClass2 : AnyObject { } // expected-error{{inheritance from non-protocol type 'AnyObject'}}
177+
extension MFSynthesizedSubClass2 : AnyObject { } // expected-error{{extension type cannot inherit from non-protocol type 'AnyObject'}}
178178

179179
extension MFSynthesizedSubClass3 : AnyObjectRefinement { }
180180

@@ -198,7 +198,7 @@ extension MMSuper1 : MMP1 { } // expected-warning{{conformance of 'MMSuper1' to
198198
extension MMSuper1 : MMP2a { } // expected-warning{{conformance of 'MMSuper1' to protocol 'MMP2a' was already stated in the type's module 'placement_module_A'}}
199199
extension MMSuper1 : MMP3b { } // okay
200200

201-
extension MMSub1 : AnyObject { } // expected-error{{inheritance from non-protocol type 'AnyObject'}}
201+
extension MMSub1 : AnyObject { } // expected-error{{extension type cannot inherit from non-protocol type 'AnyObject'}}
202202

203203
extension MMSub2 : MMP1 { } // expected-warning{{conformance of 'MMSub2' to protocol 'MMP1' was already stated in the type's module 'placement_module_A'}}
204204
extension MMSub2 : MMP2a { } // expected-warning{{conformance of 'MMSub2' to protocol 'MMP2a' was already stated in the type's module 'placement_module_A'}}
@@ -209,7 +209,7 @@ extension MMSub2 : MMAnyObjectRefinement { } // okay
209209
extension MMSub3 : MMP1 { } // expected-warning{{conformance of 'MMSub3' to protocol 'MMP1' was already stated in the type's module 'placement_module_A'}}
210210
extension MMSub3 : MMP2a { } // expected-warning{{conformance of 'MMSub3' to protocol 'MMP2a' was already stated in the type's module 'placement_module_A'}}
211211
extension MMSub3 : MMP3b { } // okay
212-
extension MMSub3 : AnyObject { } // expected-error{{inheritance from non-protocol type 'AnyObject'}}
212+
extension MMSub3 : AnyObject { } // expected-error{{extension type cannot inherit from non-protocol type 'AnyObject'}}
213213

214214
extension MMSub4 : MMP1 { } // expected-warning{{conformance of 'MMSub4' to protocol 'MMP1' was already stated in the type's module 'placement_module_B'}}
215215
extension MMSub4 : MMP2a { } // expected-warning{{conformance of 'MMSub4' to protocol 'MMP2a' was already stated in the type's module 'placement_module_B'}}

test/decl/protocol/protocol_with_superclass_objc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class Base {}
44

55
@objc protocol Protocol1 : Base {}
6-
// expected-error@-1 {{inheritance from non-protocol type 'Base'}}
6+
// expected-error@-1 {{protocol type cannot inherit from non-protocol type 'Base'}}
77

88
@objc protocol OtherProtocol {}
99

test/decl/protocol/protocols.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func test1() {
4242
}
4343

4444
protocol Bogus : Int {}
45-
// expected-error@-1{{inheritance from non-protocol, non-class type 'Int'}}
45+
// expected-error@-1{{protocol type cannot inherit from non-protocol, non-class type 'Int'}}
4646
// expected-error@-2{{type 'Self' constrained to non-protocol, non-class type 'Int'}}
4747

4848
// Explicit conformance checks (successful).

0 commit comments

Comments
 (0)