mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Error: track message and prefix/location separately. (#1529)
This allows us to combine multiple Errors together without repeating the prefix information. Also fixes several cases where two "COMPILATION ERROR" prefixes would be prepended to the same message when errors with prefixes and locations were produced by the lexer and parser.
This commit is contained in:
@@ -15,8 +15,8 @@ void AddPrelude(std::string_view prelude_file_name, Nonnull<Arena*> arena,
|
||||
if (!parse_result.ok()) {
|
||||
// Try again with tracing, to help diagnose the problem.
|
||||
ErrorOr<AST> trace_parse_result = Parse(arena, prelude_file_name, true);
|
||||
CARBON_FATAL() << "Failed to parse prelude: "
|
||||
<< trace_parse_result.error().message();
|
||||
CARBON_FATAL() << "Failed to parse prelude:\n"
|
||||
<< trace_parse_result.error();
|
||||
}
|
||||
const auto& prelude = *parse_result;
|
||||
declarations->insert(declarations->begin(), prelude.declarations.begin(),
|
||||
|
||||
Reference in New Issue
Block a user