aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/SyntaxChecker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/analysis/SyntaxChecker.cpp')
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index dc8c1806..dbaa15ed 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -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);
}
}