You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Diagnostics] SR-11419 Diagnose protocol stub note in editor mode only (#28101)
* [TypeChecker] Enclosing stubs protocol note within editor mode
* [test] Removing note from test where there is no -diagnostics-editor-mode flag
* Formatting modified code
* [tests] Fixing tests under validation-tests
Copy file name to clipboardExpand all lines: test/ClangImporter/objc_parse.swift
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -371,13 +371,13 @@ class ProtocolAdopter2 : FooProto {
371
371
set{ /* do nothing! */ }
372
372
}
373
373
}
374
-
classProtocolAdopterBad1:FooProto{ // expected-error {{type 'ProtocolAdopterBad1' does not conform to protocol 'FooProto'}} expected-note {{do you want to add protocol stubs?}}
374
+
classProtocolAdopterBad1:FooProto{ // expected-error {{type 'ProtocolAdopterBad1' does not conform to protocol 'FooProto'}}
375
375
@objcvarbar:Int=0 // expected-note {{candidate has non-matching type 'Int'}}
376
376
}
377
-
classProtocolAdopterBad2:FooProto{ // expected-error {{type 'ProtocolAdopterBad2' does not conform to protocol 'FooProto'}} expected-note {{do you want to add protocol stubs?}}
377
+
classProtocolAdopterBad2:FooProto{ // expected-error {{type 'ProtocolAdopterBad2' does not conform to protocol 'FooProto'}}
378
378
letbar:CInt=0 // expected-note {{candidate is not settable, but protocol requires it}}
379
379
}
380
-
classProtocolAdopterBad3:FooProto{ // expected-error {{type 'ProtocolAdopterBad3' does not conform to protocol 'FooProto'}} expected-note {{do you want to add protocol stubs?}}
380
+
classProtocolAdopterBad3:FooProto{ // expected-error {{type 'ProtocolAdopterBad3' does not conform to protocol 'FooProto'}}
381
381
varbar:CInt{ // expected-note {{candidate is not settable, but protocol requires it}}
Copy file name to clipboardExpand all lines: test/Constraints/invalid_stdlib_2.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
// RUN: %target-typecheck-verify-swift
2
2
3
-
classDictionary<K, V>:ExpressibleByDictionaryLiteral{ // expected-error {{type 'Dictionary<K, V>' does not conform to protocol 'ExpressibleByDictionaryLiteral'}} expected-note {{do you want to add protocol stubs?}}
3
+
classDictionary<K, V>:ExpressibleByDictionaryLiteral{ // expected-error {{type 'Dictionary<K, V>' does not conform to protocol 'ExpressibleByDictionaryLiteral'}}
4
4
typealiasKey=K
5
5
typealiasValue=V
6
6
init(dictionaryLiteral xs:(K)...){} // expected-note {{candidate has non-matching type '(dictionaryLiteral: (K)...)'}}
Copy file name to clipboardExpand all lines: test/Generics/inheritance.swift
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -56,10 +56,10 @@ func testGenericInherit() {
56
56
57
57
58
58
structSS<T>:T{} // expected-error{{inheritance from non-protocol type 'T'}}
59
-
enumSE<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}} expected-note {{do you want to add protocol stubs?}}
59
+
enumSE<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}}
60
60
61
61
// Also need Equatable for init?(RawValue)
62
-
enumSE2<T :ExpressibleByIntegerLiteral>// expected-note {{do you want to add protocol stubs?}}
62
+
enumSE2<T :ExpressibleByIntegerLiteral>
63
63
:T // expected-error {{'SE2<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}}
enumEnumWithInheritance3:FooClass{case X } // expected-error {{raw type 'FooClass' is not expressible by a string, integer, or floating-point literal}} expected-note {{do you want to add protocol stubs?}}
120
+
enumEnumWithInheritance3:FooClass{case X } // expected-error {{raw type 'FooClass' is not expressible by a string, integer, or floating-point literal}}
121
121
// expected-error@-1{{'EnumWithInheritance3' declares raw type 'FooClass', but does not conform to RawRepresentable and conformance could not be synthesized}}
122
122
// expected-error@-2{{RawRepresentable conformance cannot be synthesized because raw type 'FooClass' is not Equatable}}
enumEnumWithInheritance4:FooClass,FooProtocol{case X } // expected-error {{raw type 'FooClass' is not expressible by a string, integer, or floating-point literal}} expected-note {{do you want to add protocol stubs?}}
126
+
enumEnumWithInheritance4:FooClass,FooProtocol{case X } // expected-error {{raw type 'FooClass' is not expressible by a string, integer, or floating-point literal}}
127
127
// expected-error@-1{{'EnumWithInheritance4' declares raw type 'FooClass', but does not conform to RawRepresentable and conformance could not be synthesized}}
128
128
// expected-error@-2{{RawRepresentable conformance cannot be synthesized because raw type 'FooClass' is not Equatable}}
enumEnumWithInheritance5:FooClass,BarClass{case X } // expected-error {{raw type 'FooClass' is not expressible by a string, integer, or floating-point literal}} expected-error {{multiple enum raw types 'FooClass' and 'BarClass'}} expected-note {{do you want to add protocol stubs?}}
132
+
enumEnumWithInheritance5:FooClass,BarClass{case X } // expected-error {{raw type 'FooClass' is not expressible by a string, integer, or floating-point literal}} expected-error {{multiple enum raw types 'FooClass' and 'BarClass'}}
133
133
// expected-error@-1{{'EnumWithInheritance5' declares raw type 'FooClass', but does not conform to RawRepresentable and conformance could not be synthesized}}
134
134
// expected-error@-2{{RawRepresentable conformance cannot be synthesized because raw type 'FooClass' is not Equatable}}
Copy file name to clipboardExpand all lines: test/Parse/enum.swift
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ enum Recovery6 {
130
130
case Tusk, // expected-error {{expected identifier after comma in enum 'case' declaration}}
131
131
}
132
132
133
-
enumRawTypeEmpty:Int{} // expected-error {{an enum with no cases cannot declare a raw type}} expected-note {{do you want to add protocol stubs?}}
133
+
enumRawTypeEmpty:Int{} // expected-error {{an enum with no cases cannot declare a raw type}}
134
134
// expected-error@-1{{'RawTypeEmpty' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}}
135
135
136
136
enumRaw:Int{
@@ -146,7 +146,7 @@ enum RawTypeNotFirst : RawTypeNotFirstProtocol, Int { // expected-error {{raw ty
146
146
case E
147
147
}
148
148
149
-
enumExpressibleByRawTypeNotLiteral:Array<Int>{ // expected-error {{raw type 'Array<Int>' is not expressible by a string, integer, or floating-point literal}} expected-note {{do you want to add protocol stubs?}}
149
+
enumExpressibleByRawTypeNotLiteral:Array<Int>{ // expected-error {{raw type 'Array<Int>' is not expressible by a string, integer, or floating-point literal}}
150
150
// expected-error@-1{{'ExpressibleByRawTypeNotLiteral' declares raw type 'Array<Int>', but does not conform to RawRepresentable and conformance could not be synthesized}}
enumExpressibleByRawTypeNotIntegerLiteral:ExpressibleByFloatLiteralOnly{ // expected-error {{'ExpressibleByRawTypeNotIntegerLiteral' declares raw type 'ExpressibleByFloatLiteralOnly', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-error {{RawRepresentable conformance cannot be synthesized because raw type 'ExpressibleByFloatLiteralOnly' is not Equatable}} expected-note {{do you want to add protocol stubs?}}
173
+
enumExpressibleByRawTypeNotIntegerLiteral:ExpressibleByFloatLiteralOnly{ // expected-error {{'ExpressibleByRawTypeNotIntegerLiteral' declares raw type 'ExpressibleByFloatLiteralOnly', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-error {{RawRepresentable conformance cannot be synthesized because raw type 'ExpressibleByFloatLiteralOnly' is not Equatable}}
174
174
case Everett // expected-error {{enum cases require explicit raw values when the raw type is not expressible by integer or string literal}}
175
175
case Flanders
176
176
}
@@ -184,13 +184,13 @@ enum RawTypeWithNegativeValues : Int {
184
184
case AutoIncAcrossZero =-1, Zero, One
185
185
}
186
186
187
-
enumRawTypeWithUnicodeScalarValues:UnicodeScalar{ // expected-error {{'RawTypeWithUnicodeScalarValues' declares raw type 'UnicodeScalar' (aka 'Unicode.Scalar'), but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{do you want to add protocol stubs?}}
187
+
enumRawTypeWithUnicodeScalarValues:UnicodeScalar{ // expected-error {{'RawTypeWithUnicodeScalarValues' declares raw type 'UnicodeScalar' (aka 'Unicode.Scalar'), but does not conform to RawRepresentable and conformance could not be synthesized}}
188
188
case Kearney ="K"
189
189
case Lovejoy // expected-error {{enum cases require explicit raw values when the raw type is not expressible by integer or string literal}}
190
190
case Marshall ="M"
191
191
}
192
192
193
-
enumRawTypeWithCharacterValues:Character{ // expected-error {{'RawTypeWithCharacterValues' declares raw type 'Character', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{do you want to add protocol stubs?}}
193
+
enumRawTypeWithCharacterValues:Character{ // expected-error {{'RawTypeWithCharacterValues' declares raw type 'Character', but does not conform to RawRepresentable and conformance could not be synthesized}}
194
194
case First ="い"
195
195
case Second // expected-error {{enum cases require explicit raw values when the raw type is not expressible by integer or string literal}}
196
196
case Third ="は"
@@ -203,11 +203,11 @@ enum RawTypeWithCharacterValues_Correct : Character {
203
203
case Fourth ="\u{1F3F4}\u{E0067}\u{E0062}\u{E0065}\u{E006E}\u{E0067}\u{E007F}" // ok
204
204
}
205
205
206
-
enumRawTypeWithCharacterValues_Error1:Character{ // expected-error {{'RawTypeWithCharacterValues_Error1' declares raw type 'Character', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{do you want to add protocol stubs?}}
206
+
enumRawTypeWithCharacterValues_Error1:Character{ // expected-error {{'RawTypeWithCharacterValues_Error1' declares raw type 'Character', but does not conform to RawRepresentable and conformance could not be synthesized}}
207
207
case First ="abc" // expected-error {{cannot convert value of type 'String' to raw type 'Character'}}
208
208
}
209
209
210
-
enumRawTypeWithFloatValues:Float{ // expected-error {{'RawTypeWithFloatValues' declares raw type 'Float', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{do you want to add protocol stubs?}}
210
+
enumRawTypeWithFloatValues:Float{ // expected-error {{'RawTypeWithFloatValues' declares raw type 'Float', but does not conform to RawRepresentable and conformance could not be synthesized}}
211
211
case Northrup =1.5
212
212
case Overton // expected-error {{enum case must declare a raw value when the preceding raw value is not an integer}}
213
213
case Pettygrove =2.25
@@ -318,12 +318,12 @@ enum NonliteralRawValue : Int {
318
318
case Yeon =100+20+3 // expected-error {{raw value for enum case must be a literal}}
319
319
}
320
320
321
-
enumRawTypeWithPayload:Int{ // expected-error {{'RawTypeWithPayload' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{declared raw type 'Int' here}} expected-note {{declared raw type 'Int' here}} expected-note {{do you want to add protocol stubs?}}
321
+
enumRawTypeWithPayload:Int{ // expected-error {{'RawTypeWithPayload' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{declared raw type 'Int' here}} expected-note {{declared raw type 'Int' here}}
322
322
case Powell(Int) // expected-error {{enum with raw type cannot have cases with arguments}}
323
323
case Terwilliger(Int)=17 // expected-error {{enum with raw type cannot have cases with arguments}}
324
324
}
325
325
326
-
enumRawTypeMismatch:Int{ // expected-error {{'RawTypeMismatch' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{do you want to add protocol stubs?}}
326
+
enumRawTypeMismatch:Int{ // expected-error {{'RawTypeMismatch' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}}
327
327
case Barbur ="foo" // expected-error {{}}
328
328
}
329
329
@@ -343,12 +343,12 @@ enum DuplicateMembers3 {
343
343
case Foo(Int) // expected-error {{invalid redeclaration of 'Foo'}}
344
344
}
345
345
346
-
enumDuplicateMembers4:Int{ // expected-error {{'DuplicateMembers4' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{do you want to add protocol stubs?}}
346
+
enumDuplicateMembers4:Int{ // expected-error {{'DuplicateMembers4' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}}
347
347
case Foo =1 // expected-note {{'Foo' previously declared here}}
348
348
case Foo =2 // expected-error {{invalid redeclaration of 'Foo'}}
349
349
}
350
350
351
-
enumDuplicateMembers5:Int{ // expected-error {{'DuplicateMembers5' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{do you want to add protocol stubs?}}
351
+
enumDuplicateMembers5:Int{ // expected-error {{'DuplicateMembers5' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}}
352
352
case Foo =1 // expected-note {{'Foo' previously declared here}}
353
353
case Foo =1+1 // expected-error {{invalid redeclaration of 'Foo'}} expected-error {{raw value for enum case must be a literal}}
354
354
}
@@ -359,7 +359,7 @@ enum DuplicateMembers6 {
359
359
case Foo // expected-error {{invalid redeclaration of 'Foo'}}
360
360
}
361
361
362
-
enumDuplicateMembers7:String{ // expected-error {{'DuplicateMembers7' declares raw type 'String', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{do you want to add protocol stubs?}}
362
+
enumDuplicateMembers7:String{ // expected-error {{'DuplicateMembers7' declares raw type 'String', but does not conform to RawRepresentable and conformance could not be synthesized}}
363
363
case Foo // expected-note {{'Foo' previously declared here}}
364
364
case Foo ="Bar" // expected-error {{invalid redeclaration of 'Foo'}}
case B =0 // expected-error {{raw value for enum case is not unique}}
412
412
}
413
413
414
-
enumManyLiteralB:ManyLiteralable{ // expected-error {{'ManyLiteralB' declares raw type 'ManyLiteralable', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{do you want to add protocol stubs?}}
414
+
enumManyLiteralB:ManyLiteralable{ // expected-error {{'ManyLiteralB' declares raw type 'ManyLiteralable', but does not conform to RawRepresentable and conformance could not be synthesized}}
415
415
case A ="abc"
416
416
case B // expected-error {{enum case must declare a raw value when the preceding raw value is not an integer}}
enumfoo:String{ // expected-error {{'foo' declares raw type 'String', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{do you want to add protocol stubs?}}
443
+
enumfoo:String{ // expected-error {{'foo' declares raw type 'String', but does not conform to RawRepresentable and conformance could not be synthesized}}
444
444
case bar =nil // expected-error {{cannot convert 'nil' to raw type 'String'}}
Copy file name to clipboardExpand all lines: test/Parse/objc_enum.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ class Bar {
30
30
}
31
31
32
32
// <rdar://problem/23681566> @objc enums with payloads rejected with no source location info
33
-
@objcenumr23681566:Int32{ // expected-error {{'r23681566' declares raw type 'Int32', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{declared raw type 'Int32' here}} expected-note {{do you want to add protocol stubs?}}
33
+
@objcenumr23681566:Int32{ // expected-error {{'r23681566' declares raw type 'Int32', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{declared raw type 'Int32' here}}
34
34
case Foo(progress:Int) // expected-error {{enum with raw type cannot have cases with arguments}}
Copy file name to clipboardExpand all lines: test/Parse/recovery.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -761,7 +761,7 @@ let tryx = 123 // expected-error 2 {{invalid character in source file
761
761
762
762
763
763
// <rdar://problem/21369926> Malformed Swift Enums crash playground service
764
-
enum Rank: Int { // expected-error {{'Rank' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{do you want to add protocol stubs?}}
764
+
enum Rank: Int { // expected-error {{'Rank' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}}
765
765
case Ace =1
766
766
case Two =2.1 // expected-error {{cannot convert value of type 'Double' to raw type 'Int'}}
0 commit comments