mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Suggest correct version for pragma and complain about pre-release version.
This commit is contained in:
@@ -52,13 +52,22 @@ void SyntaxChecker::endVisit(SourceUnit const& _sourceUnit)
|
||||
{
|
||||
if (!m_versionPragmaFound)
|
||||
{
|
||||
string errorString("Source file does not specify required compiler version!");
|
||||
SemVerVersion recommendedVersion{string(VersionString)};
|
||||
if (!recommendedVersion.isPrerelease())
|
||||
errorString +=
|
||||
"Consider adding \"pragma solidity ^" +
|
||||
to_string(recommendedVersion.major()) +
|
||||
string(".") +
|
||||
to_string(recommendedVersion.minor()) +
|
||||
string(".") +
|
||||
to_string(recommendedVersion.patch());
|
||||
string(";\"");
|
||||
|
||||
auto err = make_shared<Error>(Error::Type::Warning);
|
||||
*err <<
|
||||
errinfo_sourceLocation(_sourceUnit.location()) <<
|
||||
errinfo_comment(
|
||||
string("Source file does not specify required compiler version! ") +
|
||||
string("Consider adding \"pragma solidity ^") + VersionNumber + string(";\".")
|
||||
);
|
||||
errinfo_comment(errorString);
|
||||
m_errors.push_back(err);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user