From 962ba8288bc44a59cdc99c5f67093353b0d8cc9b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sun, 20 Sep 2015 12:41:28 -0700 Subject: [PATCH] Conflicts should cause errors instead of warnings. --- scripts/processDiagnosticMessages.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/processDiagnosticMessages.ts b/scripts/processDiagnosticMessages.ts index e40f119b382..1eead82d9fe 100644 --- a/scripts/processDiagnosticMessages.ts +++ b/scripts/processDiagnosticMessages.ts @@ -37,22 +37,29 @@ function main(): void { function checkForUniqueCodes(messages: string[], diagnosticTable: InputDiagnosticMessageTable) { const originalMessageForCode: string[] = []; + let numConflicts = 0; for (const currentMessage of messages) { const code = diagnosticTable[currentMessage].code; if (code in originalMessageForCode) { const originalMessage = originalMessageForCode[code]; - ts.sys.write("\x1b[93m"); // High intensity yellow. - ts.sys.write("Warning"); + ts.sys.write("\x1b[91m"); // High intensity red. + ts.sys.write("Error"); ts.sys.write("\x1b[0m"); // Reset formatting. ts.sys.write(`: Diagnostic code '${code}' conflicts between "${originalMessage}" and "${currentMessage}".`); ts.sys.write(ts.sys.newLine + ts.sys.newLine); + + numConflicts++; } else { originalMessageForCode[code] = currentMessage; } } + + if (numConflicts > 0) { + throw new Error(`Found ${numConflicts} conflict(s) in diagnostic codes.`); + } } function buildUniqueNameMap(names: string[]): ts.Map {