Skip to content

Commit 962ba82

Browse files
Conflicts should cause errors instead of warnings.
1 parent b265467 commit 962ba82

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

scripts/processDiagnosticMessages.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,29 @@ function main(): void {
3737

3838
function checkForUniqueCodes(messages: string[], diagnosticTable: InputDiagnosticMessageTable) {
3939
const originalMessageForCode: string[] = [];
40+
let numConflicts = 0;
4041

4142
for (const currentMessage of messages) {
4243
const code = diagnosticTable[currentMessage].code;
4344

4445
if (code in originalMessageForCode) {
4546
const originalMessage = originalMessageForCode[code];
46-
ts.sys.write("\x1b[93m"); // High intensity yellow.
47-
ts.sys.write("Warning");
47+
ts.sys.write("\x1b[91m"); // High intensity red.
48+
ts.sys.write("Error");
4849
ts.sys.write("\x1b[0m"); // Reset formatting.
4950
ts.sys.write(`: Diagnostic code '${code}' conflicts between "${originalMessage}" and "${currentMessage}".`);
5051
ts.sys.write(ts.sys.newLine + ts.sys.newLine);
52+
53+
numConflicts++;
5154
}
5255
else {
5356
originalMessageForCode[code] = currentMessage;
5457
}
5558
}
59+
60+
if (numConflicts > 0) {
61+
throw new Error(`Found ${numConflicts} conflict(s) in diagnostic codes.`);
62+
}
5663
}
5764

5865
function buildUniqueNameMap(names: string[]): ts.Map<string> {

0 commit comments

Comments
 (0)