Merge pull request #9344 from ethereum/issue-3412

Allow overrides to have a more strict mutability than super
This commit is contained in:
chriseth
2020-07-16 18:50:51 +02:00
committed by GitHub
13 changed files with 113 additions and 8 deletions
+7 -1
View File
@@ -587,7 +587,13 @@ void OverrideChecker::checkOverride(OverrideProxy const& _overriding, OverridePr
// This is only relevant for a function overriding a function.
if (_overriding.isFunction())
{
if (_overriding.stateMutability() != _super.stateMutability())
// Stricter mutability is always okay except when super is Payable
if ((
_overriding.stateMutability() > _super.stateMutability() ||
_super.stateMutability() == StateMutability::Payable
) &&
_overriding.stateMutability() != _super.stateMutability()
)
overrideError(
_overriding,
_super,