Avoid duplicate errors due to function overrides

This commit is contained in:
Federico Bond 2017-07-21 01:11:16 -03:00 committed by Alex Beregszaszi
parent d4997dd9a3
commit 3571db6e3f

View File

@ -308,19 +308,19 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& function, Func
if (function.visibility() != super.visibility()) if (function.visibility() != super.visibility())
overrideError(function, super, "Overriding function visibility differs."); overrideError(function, super, "Overriding function visibility differs.");
if (function.isDeclaredConst() && !super.isDeclaredConst()) else if (function.isDeclaredConst() && !super.isDeclaredConst())
overrideError(function, super, "Overriding function should not be declared constant."); overrideError(function, super, "Overriding function should not be declared constant.");
if (!function.isDeclaredConst() && super.isDeclaredConst()) else if (!function.isDeclaredConst() && super.isDeclaredConst())
overrideError(function, super, "Overriding function should be declared constant."); overrideError(function, super, "Overriding function should be declared constant.");
if (function.isPayable() && !super.isPayable()) else if (function.isPayable() && !super.isPayable())
overrideError(function, super, "Overriding function should not be declared payable."); overrideError(function, super, "Overriding function should not be declared payable.");
if (!function.isPayable() && super.isPayable()) else if (!function.isPayable() && super.isPayable())
overrideError(function, super, "Overriding function should be declared payable."); overrideError(function, super, "Overriding function should be declared payable.");
if (functionType != superType) else if (functionType != superType)
overrideError(function, super, "Overriding function return types differ."); overrideError(function, super, "Overriding function return types differ.");
} }