mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow visibility change from external to public.
This commit is contained in:
parent
bc137c2eeb
commit
0f0e466d36
@ -413,16 +413,14 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& _function, Fun
|
|||||||
|
|
||||||
if (_function.visibility() != _super.visibility())
|
if (_function.visibility() != _super.visibility())
|
||||||
{
|
{
|
||||||
// visibility is enforced to be external in interfaces, but a contract can override that with public
|
// Visibility change from external to public is fine.
|
||||||
if (
|
// Any other change is disallowed.
|
||||||
_super.inContractKind() == ContractDefinition::ContractKind::Interface &&
|
if (!(
|
||||||
_function.inContractKind() != ContractDefinition::ContractKind::Interface &&
|
_super.visibility() == FunctionDefinition::Visibility::External &&
|
||||||
_function.visibility() == FunctionDefinition::Visibility::Public
|
_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())
|
else if (_function.stateMutability() != _super.stateMutability())
|
||||||
overrideError(
|
overrideError(
|
||||||
_function,
|
_function,
|
||||||
@ -433,7 +431,6 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& _function, Fun
|
|||||||
stateMutabilityToString(_function.stateMutability()) +
|
stateMutabilityToString(_function.stateMutability()) +
|
||||||
"\"."
|
"\"."
|
||||||
);
|
);
|
||||||
|
|
||||||
else if (functionType != superType)
|
else if (functionType != superType)
|
||||||
overrideError(_function, _super, "Overriding function return types differ.");
|
overrideError(_function, _super, "Overriding function return types differ.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user