diff options
author | chriseth <chris@ethereum.org> | 2017-10-18 17:59:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-18 17:59:40 +0800 |
commit | e854da1a8c2253704e412214e8115fd1c1c819f2 (patch) | |
tree | edc7f6a7cd392ee4681c16536f7692a05a4f1de4 /libsolidity | |
parent | e247524bd563371e2ed2b871a0185ad033c1de24 (diff) | |
parent | 8a8a71de84f5bd71fcea4d31d5a53fde7820ead6 (diff) | |
download | dexon-solidity-e854da1a8c2253704e412214e8115fd1c1c819f2.tar.gz dexon-solidity-e854da1a8c2253704e412214e8115fd1c1c819f2.tar.zst dexon-solidity-e854da1a8c2253704e412214e8115fd1c1c819f2.zip |
Merge pull request #2925 from ethereum/tuple-value-check
Validate each tuple literal
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index c2fba565..746e762e 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1293,6 +1293,12 @@ bool TypeChecker::visit(TupleExpression const& _tuple) { components[i]->accept(*this); types.push_back(type(*components[i])); + + // Note: code generation will visit each of the expression even if they are not assigned from. + if (types[i]->category() == Type::Category::RationalNumber && components.size() > 1) + if (!dynamic_cast<RationalNumberType const&>(*types[i]).mobileType()) + m_errorReporter.fatalTypeError(components[i]->location(), "Invalid rational number."); + if (_tuple.isInlineArray()) solAssert(!!types[i], "Inline array cannot have empty components"); if (_tuple.isInlineArray()) |