diff options
author | chriseth <chris@ethereum.org> | 2018-02-21 07:40:38 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-03-21 22:53:29 +0800 |
commit | cc2f71e4acede70f6c220d3d0ba407ab73c2024c (patch) | |
tree | b280c6bbd441b395a3ed172bdb01d60f40ff15a7 /libsolidity/analysis | |
parent | 32c94f505901201126000eb12087251f5695acbd (diff) | |
download | dexon-solidity-cc2f71e4acede70f6c220d3d0ba407ab73c2024c.tar dexon-solidity-cc2f71e4acede70f6c220d3d0ba407ab73c2024c.tar.gz dexon-solidity-cc2f71e4acede70f6c220d3d0ba407ab73c2024c.tar.bz2 dexon-solidity-cc2f71e4acede70f6c220d3d0ba407ab73c2024c.tar.lz dexon-solidity-cc2f71e4acede70f6c220d3d0ba407ab73c2024c.tar.xz dexon-solidity-cc2f71e4acede70f6c220d3d0ba407ab73c2024c.tar.zst dexon-solidity-cc2f71e4acede70f6c220d3d0ba407ab73c2024c.zip |
Move dynamic type removal out of the type system.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index bebdb9b6..c8e64c78 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1551,16 +1551,22 @@ bool TypeChecker::visit(FunctionCall const& _functionCall) _functionCall.expression().annotation().isPure && functionType->isPure(); + bool allowDynamicTypes = false; // @TODO if (!functionType) { m_errorReporter.typeError(_functionCall.location(), "Type is not callable"); _functionCall.annotation().type = make_shared<TupleType>(); return false; } - else if (functionType->returnParameterTypes().size() == 1) - _functionCall.annotation().type = functionType->returnParameterTypes().front(); + + auto returnTypes = + allowDynamicTypes ? + functionType->returnParameterTypes() : + functionType->returnParameterTypesWithoutDynamicTypes(); + if (returnTypes.size() == 1) + _functionCall.annotation().type = returnTypes.front(); else - _functionCall.annotation().type = make_shared<TupleType>(functionType->returnParameterTypes()); + _functionCall.annotation().type = make_shared<TupleType>(returnTypes); if (auto functionName = dynamic_cast<Identifier const*>(&_functionCall.expression())) { |