Fix test error reporting if we ignore warnings.

This commit is contained in:
chriseth 2017-06-22 16:32:46 +02:00
parent af7ff3a3ef
commit c73ba612f4

View File

@ -103,16 +103,22 @@ parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false,
if (success) if (success)
if (!StaticAnalyzer(errorReporter).analyze(*sourceUnit)) if (!StaticAnalyzer(errorReporter).analyze(*sourceUnit))
success = false; success = false;
if (errorReporter.errors().size() > 1 && !_allowMultipleErrors) std::shared_ptr<Error const> error;
BOOST_FAIL("Multiple errors found");
for (auto const& currentError: errorReporter.errors()) for (auto const& currentError: errorReporter.errors())
{ {
if ( if (
(_reportWarnings && currentError->type() == Error::Type::Warning) || (_reportWarnings && currentError->type() == Error::Type::Warning) ||
(!_reportWarnings && currentError->type() != Error::Type::Warning) (!_reportWarnings && currentError->type() != Error::Type::Warning)
) )
return make_pair(sourceUnit, currentError); {
if (error && !_allowMultipleErrors)
BOOST_FAIL("Multiple errors found");
if (!error)
error = currentError;
}
} }
if (error)
return make_pair(sourceUnit, error);
} }
catch (InternalCompilerError const& _e) catch (InternalCompilerError const& _e)
{ {