aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-11-22 22:04:43 +0800
committerchriseth <chris@ethereum.org>2018-11-26 19:41:26 +0800
commit0f0e466d36a3e09c4c5873998b5dd32dbe8025d6 (patch)
tree30dbd46fb8d911d554ef58144f7943b92492c82f /libsolidity
parentbc137c2eeb6920cf33eea1ceaab49df3dfddad07 (diff)
downloaddexon-solidity-0f0e466d36a3e09c4c5873998b5dd32dbe8025d6.tar.gz
dexon-solidity-0f0e466d36a3e09c4c5873998b5dd32dbe8025d6.tar.zst
dexon-solidity-0f0e466d36a3e09c4c5873998b5dd32dbe8025d6.zip
Allow visibility change from external to public.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index a6c23ada..d503b9ec 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -413,16 +413,14 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& _function, Fun
if (_function.visibility() != _super.visibility())
{
- // visibility is enforced to be external in interfaces, but a contract can override that with public
- if (
- _super.inContractKind() == ContractDefinition::ContractKind::Interface &&
- _function.inContractKind() != ContractDefinition::ContractKind::Interface &&
+ // Visibility change from external to public is fine.
+ // Any other change is disallowed.
+ if (!(
+ _super.visibility() == FunctionDefinition::Visibility::External &&
_function.visibility() == FunctionDefinition::Visibility::Public
- )
- return;
- overrideError(_function, _super, "Overriding function visibility differs.");
+ ))
+ overrideError(_function, _super, "Overriding function visibility differs.");
}
-
else if (_function.stateMutability() != _super.stateMutability())
overrideError(
_function,
@@ -433,7 +431,6 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& _function, Fun
stateMutabilityToString(_function.stateMutability()) +
"\"."
);
-
else if (functionType != superType)
overrideError(_function, _super, "Overriding function return types differ.");
}