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 {
32
32
33
33
case note
34
34
35
+ case remark
36
+
35
37
// FIXME: Kill this
36
38
case ignored
37
39
}
@@ -164,6 +166,10 @@ extension Diagnostic.Message {
164
166
. init( data: data, behavior: . note)
165
167
}
166
168
169
+ public static func remark( _ data: DiagnosticData ) -> Diagnostic . Message {
170
+ . init( data: data, behavior: . remark)
171
+ }
172
+
167
173
public static func error( _ str: String ) -> Diagnostic . Message {
168
174
. error( StringDiagnostic ( str) )
169
175
}
@@ -175,6 +181,10 @@ extension Diagnostic.Message {
175
181
public static func note( _ str: String ) -> Diagnostic . Message {
176
182
. note( StringDiagnostic ( str) )
177
183
}
184
+
185
+ public static func remark( _ str: String ) -> Diagnostic . Message {
186
+ . remark( StringDiagnostic ( str) )
187
+ }
178
188
}
179
189
180
190
public struct StringDiagnostic : DiagnosticData {
Original file line number Diff line number Diff line change @@ -54,6 +54,13 @@ extension DiagnosticsEngine {
54
54
emit ( . note( note) , location: location)
55
55
}
56
56
57
+ public func emit(
58
+ remark: String ,
59
+ location: DiagnosticLocation = UnknownLocation . location
60
+ ) {
61
+ emit ( . remark( remark) , location: location)
62
+ }
63
+
57
64
/// Emit a Swift error.
58
65
///
59
66
/// 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 {
83
83
)
84
84
diagnostics. emit ( . error( StringDiagnostic ( " diag 2 " ) ) , location: location)
85
85
diagnostics. emit ( . note( StringDiagnostic ( " diag 3 " ) ) , location: location)
86
+ diagnostics. emit ( . remark( StringDiagnostic ( " diag 4 " ) ) , location: location)
86
87
diagnostics. emit ( . error( StringDiagnostic ( " end " ) ) , location: location)
87
88
88
- XCTAssertEqual ( handledDiagnostics. count, 4 )
89
+ XCTAssertEqual ( handledDiagnostics. count, 5 )
89
90
for diagnostic in handledDiagnostics {
90
91
XCTAssertEqual ( diagnostic. location. description, location. description)
91
92
}
92
93
XCTAssertEqual ( handledDiagnostics [ 0 ] . description, " literal foo, bar 2 str bar str " )
93
94
XCTAssertEqual ( handledDiagnostics [ 1 ] . description, " diag 2 " )
94
95
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 " )
96
98
}
97
99
}
You can’t perform that action at this time.
0 commit comments