mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SwiftSyntax] Publicize DiagnosticEngine.addConsumer and add hasErrors property (#14996)
* [SwiftSyntax] Publicize DiagnosticEngine.addConsumer and add hasErrors property * [Syntax] Make DiagnosticEngine.hasErrors public
This commit is contained in:
@@ -33,6 +33,7 @@ Diagnostics.test("DiagnosticEmission") {
|
||||
let fixLoc = loc()
|
||||
|
||||
let engine = DiagnosticEngine()
|
||||
expectFalse(engine.hasErrors)
|
||||
|
||||
engine.diagnose(.cannotConvert(fromType: "Int", toType: "Bool"),
|
||||
location: startLoc) {
|
||||
@@ -42,10 +43,11 @@ Diagnostics.test("DiagnosticEmission") {
|
||||
|
||||
expectEqual(engine.diagnostics.count, 1)
|
||||
guard let diag = engine.diagnostics.first else { return }
|
||||
expectEqual(diag.message.text,
|
||||
expectEqual(diag.message.text,
|
||||
"cannot convert value of type 'Int' to 'Bool'")
|
||||
expectEqual(diag.message.severity, .error)
|
||||
expectEqual(diag.notes.count, 1)
|
||||
expectTrue(engine.hasErrors)
|
||||
|
||||
guard let note = diag.notes.first else { return }
|
||||
expectEqual(note.message.text, "check for explicit equality to '0'")
|
||||
|
||||
Reference in New Issue
Block a user