A pragma version mismatch is not fatal if ...

error recovery is desired.

Fixes #7085
This commit is contained in:
rocky
2019-07-17 19:01:01 -04:00
parent 15cba9163e
commit f9b631f410
2 changed files with 26 additions and 10 deletions
+9 -6
View File
@@ -118,12 +118,15 @@ void Parser::parsePragmaVersion(SourceLocation const& _location, vector<Token> c
static SemVerVersion const currentVersion{string(VersionString)};
// FIXME: only match for major version incompatibility
if (!matchExpression.matches(currentVersion))
m_errorReporter.fatalParserError(
_location,
"Source file requires different compiler version (current compiler is " +
string(VersionString) + " - note that nightly builds are considered to be "
"strictly less than the released version"
);
// If m_parserErrorRecovery is true, the same message will appear from SyntaxChecker::visit(),
// so we don't need to report anything here.
if (!m_parserErrorRecovery)
m_errorReporter.fatalParserError(
_location,
"Source file requires different compiler version (current compiler is " +
string(VersionString) + " - note that nightly builds are considered to be "
"strictly less than the released version"
);
}
ASTPointer<PragmaDirective> Parser::parsePragmaDirective()