mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Properly disallow different return types for interface overloads with different visibilities.
This commit is contained in:
parent
f937896727
commit
4d7799eed4
@ -409,6 +409,8 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& _function, Fun
|
|||||||
|
|
||||||
if (!functionType->hasEqualParameterTypes(*superType))
|
if (!functionType->hasEqualParameterTypes(*superType))
|
||||||
return;
|
return;
|
||||||
|
if (!functionType->hasEqualReturnTypes(*superType))
|
||||||
|
overrideError(_function, _super, "Overriding function return types differ.");
|
||||||
|
|
||||||
if (!_function.annotation().superFunction)
|
if (!_function.annotation().superFunction)
|
||||||
_function.annotation().superFunction = &_super;
|
_function.annotation().superFunction = &_super;
|
||||||
@ -423,7 +425,7 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& _function, Fun
|
|||||||
))
|
))
|
||||||
overrideError(_function, _super, "Overriding function visibility differs.");
|
overrideError(_function, _super, "Overriding function visibility differs.");
|
||||||
}
|
}
|
||||||
else if (_function.stateMutability() != _super.stateMutability())
|
if (_function.stateMutability() != _super.stateMutability())
|
||||||
overrideError(
|
overrideError(
|
||||||
_function,
|
_function,
|
||||||
_super,
|
_super,
|
||||||
@ -433,8 +435,6 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& _function, Fun
|
|||||||
stateMutabilityToString(_function.stateMutability()) +
|
stateMutabilityToString(_function.stateMutability()) +
|
||||||
"\"."
|
"\"."
|
||||||
);
|
);
|
||||||
else if (*functionType != *superType)
|
|
||||||
overrideError(_function, _super, "Overriding function return types differ.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypeChecker::overrideError(FunctionDefinition const& function, FunctionDefinition const& super, string message)
|
void TypeChecker::overrideError(FunctionDefinition const& function, FunctionDefinition const& super, string message)
|
||||||
|
Loading…
Reference in New Issue
Block a user