Use state mutability in override error messages

This commit is contained in:
Alex Beregszaszi
2017-08-16 17:23:09 +01:00
parent a2aaa47ee2
commit a61c88e9fe
2 changed files with 14 additions and 15 deletions
+10 -11
View File
@@ -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.");