[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:
Alex Hoppen
2024-08-05 13:15:07 -07:00
parent 2b2b763697
commit 66104395d7
143 changed files with 889 additions and 690 deletions

View File

@@ -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