@@ -63,11 +63,9 @@ func parseAndEmitDiagnostics(
63
63
for diagnostic in diagnostics {
64
64
let location = diagnostic. location ( converter: expectedConverter)
65
65
66
- // Downgrade editor placeholders to warnings , because it is useful to support formatting
66
+ // Ignore editor placeholders, because it is useful to support formatting
67
67
// in-progress files that contain those.
68
- if diagnostic. diagnosticID == StaticTokenError . editorPlaceholder. diagnosticID {
69
- parsingDiagnosticHandler ( downgradedToWarning ( diagnostic) , location)
70
- } else {
68
+ if diagnostic. diagnosticID != StaticTokenError . editorPlaceholder. diagnosticID {
71
69
parsingDiagnosticHandler ( diagnostic, location)
72
70
hasErrors = true
73
71
}
@@ -79,29 +77,3 @@ func parseAndEmitDiagnostics(
79
77
}
80
78
return sourceFile
81
79
}
82
-
83
- // Wraps a `DiagnosticMessage` but forces its severity to be that of a warning instead of an error.
84
- struct DowngradedDiagnosticMessage : DiagnosticMessage {
85
- var originalDiagnostic : DiagnosticMessage
86
-
87
- var message : String { originalDiagnostic. message }
88
-
89
- var diagnosticID : SwiftDiagnostics . MessageID { originalDiagnostic. diagnosticID }
90
-
91
- var severity : DiagnosticSeverity { . warning }
92
- }
93
-
94
- /// Returns a new `Diagnostic` that is identical to the given diagnostic, except that its severity
95
- /// has been downgraded to a warning.
96
- func downgradedToWarning( _ diagnostic: Diagnostic ) -> Diagnostic {
97
- // `Diagnostic` is immutable, so create a new one with the same values except for the
98
- // severity-downgraded message.
99
- return Diagnostic (
100
- node: diagnostic. node,
101
- position: diagnostic. position,
102
- message: DowngradedDiagnosticMessage ( originalDiagnostic: diagnostic. diagMessage) ,
103
- highlights: diagnostic. highlights,
104
- notes: diagnostic. notes,
105
- fixIts: diagnostic. fixIts
106
- )
107
- }
0 commit comments