File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed
Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ public struct Diagnostic: CustomStringConvertible {
3232
3333 case note
3434
35+ case remark
36+
3537 // FIXME: Kill this
3638 case ignored
3739 }
@@ -164,6 +166,10 @@ extension Diagnostic.Message {
164166 . init( data: data, behavior: . note)
165167 }
166168
169+ public static func remark( _ data: DiagnosticData ) -> Diagnostic . Message {
170+ . init( data: data, behavior: . remark)
171+ }
172+
167173 public static func error( _ str: String ) -> Diagnostic . Message {
168174 . error( StringDiagnostic ( str) )
169175 }
@@ -175,6 +181,10 @@ extension Diagnostic.Message {
175181 public static func note( _ str: String ) -> Diagnostic . Message {
176182 . note( StringDiagnostic ( str) )
177183 }
184+
185+ public static func remark( _ str: String ) -> Diagnostic . Message {
186+ . remark( StringDiagnostic ( str) )
187+ }
178188}
179189
180190public struct StringDiagnostic : DiagnosticData {
Original file line number Diff line number Diff line change @@ -54,6 +54,13 @@ extension DiagnosticsEngine {
5454 emit ( . note( note) , location: location)
5555 }
5656
57+ public func emit(
58+ remark: String ,
59+ location: DiagnosticLocation = UnknownLocation . location
60+ ) {
61+ emit ( . remark( remark) , location: location)
62+ }
63+
5764 /// Emit a Swift error.
5865 ///
5966 /// Errors will be converted into diagnostic data if possible.
Original file line number Diff line number Diff line change @@ -83,15 +83,17 @@ class DiagnosticsEngineTests: XCTestCase {
8383 )
8484 diagnostics. emit ( . error( StringDiagnostic ( " diag 2 " ) ) , location: location)
8585 diagnostics. emit ( . note( StringDiagnostic ( " diag 3 " ) ) , location: location)
86+ diagnostics. emit ( . remark( StringDiagnostic ( " diag 4 " ) ) , location: location)
8687 diagnostics. emit ( . error( StringDiagnostic ( " end " ) ) , location: location)
8788
88- XCTAssertEqual ( handledDiagnostics. count, 4 )
89+ XCTAssertEqual ( handledDiagnostics. count, 5 )
8990 for diagnostic in handledDiagnostics {
9091 XCTAssertEqual ( diagnostic. location. description, location. description)
9192 }
9293 XCTAssertEqual ( handledDiagnostics [ 0 ] . description, " literal foo, bar 2 str bar str " )
9394 XCTAssertEqual ( handledDiagnostics [ 1 ] . description, " diag 2 " )
9495 XCTAssertEqual ( handledDiagnostics [ 2 ] . description, " diag 3 " )
95- XCTAssertEqual ( handledDiagnostics [ 3 ] . description, " end " )
96+ XCTAssertEqual ( handledDiagnostics [ 3 ] . description, " diag 4 " )
97+ XCTAssertEqual ( handledDiagnostics [ 4 ] . description, " end " )
9698 }
9799}
You can’t perform that action at this time.
0 commit comments