File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
test/diagnostics/Localization Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -1114,16 +1114,25 @@ void DiagnosticEngine::emitDiagnostic(const Diagnostic &diagnostic) {
1114
1114
llvm::StringRef
1115
1115
DiagnosticEngine::diagnosticStringFor (const DiagID id,
1116
1116
bool printDiagnosticName) {
1117
- // TODO: Print diagnostic names from `localization`.
1118
- if (printDiagnosticName) {
1119
- return debugDiagnosticStrings[(unsigned )id];
1120
- }
1121
1117
auto defaultMessage = diagnosticStrings[(unsigned )id];
1118
+ auto diagnosticName = diagnosticNameStrings[(unsigned )id];
1122
1119
if (localization) {
1123
1120
auto localizedMessage =
1124
1121
localization.get ()->getMessageOr (id, defaultMessage);
1122
+ if (printDiagnosticName) {
1123
+ std::string debugDiagnosticString = localizedMessage.str ().c_str ();
1124
+ debugDiagnosticString += diagnosticName;
1125
+ const std::string &localizedDebugDiagnosticString = debugDiagnosticString;
1126
+ return localizedDebugDiagnosticString;
1127
+ }
1125
1128
return localizedMessage;
1126
1129
}
1130
+
1131
+ if (printDiagnosticName) {
1132
+ const std::string &debugDiagnosticString =
1133
+ std::string (defaultMessage) + diagnosticName;
1134
+ return debugDiagnosticString;
1135
+ }
1127
1136
return defaultMessage;
1128
1137
}
1129
1138
Original file line number Diff line number Diff line change @@ -15,4 +15,4 @@ var self1 = self1 // expected-note 2{{through reference here}}
15
15
struct Broken {
16
16
var b : Bool = True // expected-error{{impossible de trouver 'True' portée}}
17
17
}
18
- var v1 : Int[1 // expected-error {{expected ']' in array type}} expected-note {{to match this opening '[' }}
18
+ // CHECK_NAMES: error: impossible de trouver 'True' portée [cannot_find_in_scope]{{$ }}
You can’t perform that action at this time.
0 commit comments