aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-16 07:29:59 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-08-17 00:23:09 +0800
commita61c88e9fea2cb61bc9db11d3eded033a7630c45 (patch)
tree9867c6c8ddaf5e381524f365f6d3d6f8dfe2f6a5 /libsolidity/analysis
parenta2aaa47ee2032b522ca62249b210c06d3ca3c441 (diff)
downloaddexon-solidity-a61c88e9fea2cb61bc9db11d3eded033a7630c45.tar.gz
dexon-solidity-a61c88e9fea2cb61bc9db11d3eded033a7630c45.tar.zst
dexon-solidity-a61c88e9fea2cb61bc9db11d3eded033a7630c45.zip
Use state mutability in override error messages
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 0c457039..0764bf67 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -318,17 +318,16 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& function, Func
if (function.visibility() != super.visibility())
overrideError(function, super, "Overriding function visibility differs.");
- else if (function.isDeclaredConst() && !super.isDeclaredConst())
- overrideError(function, super, "Overriding function should not be declared constant.");
-
- else if (!function.isDeclaredConst() && super.isDeclaredConst())
- overrideError(function, super, "Overriding function should be declared constant.");
-
- else if (function.isPayable() && !super.isPayable())
- overrideError(function, super, "Overriding function should not be declared payable.");
-
- else if (!function.isPayable() && super.isPayable())
- overrideError(function, super, "Overriding function should be declared payable.");
+ else if (function.stateMutability() != super.stateMutability())
+ overrideError(
+ function,
+ super,
+ "Overriding function changes state mutability from \"" +
+ stateMutabilityToString(super.stateMutability()) +
+ "\" to \"" +
+ stateMutabilityToString(function.stateMutability()) +
+ "\"."
+ );
else if (functionType != superType)
overrideError(function, super, "Overriding function return types differ.");