aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-11-23 00:22:12 +0800
committerchriseth <chris@ethereum.org>2018-11-26 23:51:28 +0800
commit4d7799eed467009323e43d36134eba64bfafad34 (patch)
tree027efdcdbb1e7f7e366c467afbd5b8d4436741d2
parentf937896727d85dcdbb60783d10f9cea1eaf9f925 (diff)
downloaddexon-solidity-4d7799eed467009323e43d36134eba64bfafad34.tar.gz
dexon-solidity-4d7799eed467009323e43d36134eba64bfafad34.tar.zst
dexon-solidity-4d7799eed467009323e43d36134eba64bfafad34.zip
Properly disallow different return types for interface overloads with different visibilities.
-rw-r--r--libsolidity/analysis/TypeChecker.cpp6
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)