diff options
author | chriseth <chris@ethereum.org> | 2018-11-23 00:22:12 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-11-26 23:51:28 +0800 |
commit | 4d7799eed467009323e43d36134eba64bfafad34 (patch) | |
tree | 027efdcdbb1e7f7e366c467afbd5b8d4436741d2 /libsolidity | |
parent | f937896727d85dcdbb60783d10f9cea1eaf9f925 (diff) | |
download | dexon-solidity-4d7799eed467009323e43d36134eba64bfafad34.tar dexon-solidity-4d7799eed467009323e43d36134eba64bfafad34.tar.gz dexon-solidity-4d7799eed467009323e43d36134eba64bfafad34.tar.bz2 dexon-solidity-4d7799eed467009323e43d36134eba64bfafad34.tar.lz dexon-solidity-4d7799eed467009323e43d36134eba64bfafad34.tar.xz dexon-solidity-4d7799eed467009323e43d36134eba64bfafad34.tar.zst dexon-solidity-4d7799eed467009323e43d36134eba64bfafad34.zip |
Properly disallow different return types for interface overloads with different visibilities.
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 6295e083..1a3844ad 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -409,6 +409,8 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& _function, Fun if (!functionType->hasEqualParameterTypes(*superType)) return; + if (!functionType->hasEqualReturnTypes(*superType)) + overrideError(_function, _super, "Overriding function return types differ."); if (!_function.annotation().superFunction) _function.annotation().superFunction = &_super; @@ -423,7 +425,7 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& _function, Fun )) overrideError(_function, _super, "Overriding function visibility differs."); } - else if (_function.stateMutability() != _super.stateMutability()) + if (_function.stateMutability() != _super.stateMutability()) overrideError( _function, _super, @@ -433,8 +435,6 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& _function, Fun 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) |