mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Sema/SourceKit] Emit same diagnostics for missing protocol requirements on the command line and in SourceKit
Some editors use diagnostics from SourceKit to replace build issues. This causes issues if the diagnostics from SourceKit are formatted differently than the build issues. Make sure they are rendered the same way, removing most uses of `DiagnosticsEditorMode`. To do so, always emit the `add stubs for conformance` note (which previously was only emitted in editor mode) and remove all `; add <something>` suffixes from notes that state which requirements are missing. rdar://129283608
This commit is contained in:
@@ -35,16 +35,16 @@ let _ = IntKey(intValue: 3)
|
||||
|
||||
// Enums with a different raw value conforming to CodingKey should not get
|
||||
// implicit derived conformance.
|
||||
enum Int8Key : Int8, CodingKey { // expected-error {{type 'Int8Key' does not conform to protocol 'CodingKey'}}
|
||||
enum Int8Key : Int8, CodingKey { // expected-error {{type 'Int8Key' does not conform to protocol 'CodingKey'}} expected-note {{add stubs for conformance}}
|
||||
case a = -1, b = 0, c = 1
|
||||
}
|
||||
|
||||
// Structs conforming to CodingKey should not get implicit derived conformance.
|
||||
struct StructKey : CodingKey { // expected-error {{type 'StructKey' does not conform to protocol 'CodingKey'}}
|
||||
struct StructKey : CodingKey { // expected-error {{type 'StructKey' does not conform to protocol 'CodingKey'}} expected-note {{add stubs for conformance}}
|
||||
}
|
||||
|
||||
// Classes conforming to CodingKey should not get implicit derived conformance.
|
||||
class ClassKey : CodingKey { //expected-error {{type 'ClassKey' does not conform to protocol 'CodingKey'}}
|
||||
class ClassKey : CodingKey { //expected-error {{type 'ClassKey' does not conform to protocol 'CodingKey'}} expected-note {{add stubs for conformance}}
|
||||
}
|
||||
|
||||
// Types which are valid for CodingKey derived conformance should not get that
|
||||
|
||||
Reference in New Issue
Block a user