Allow overrides to have a more strict mutability than super

This commit is contained in:
Mathias Baumann
2020-07-16 17:55:12 +02:00
parent 052c4a86a0
commit dfffecfe2c
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,