aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-09-18 18:39:17 +0800
committerchriseth <chris@ethereum.org>2017-10-18 00:59:01 +0800
commitc99d2aae042643d9d26a4b952e07ca90f11a83c3 (patch)
tree4935870d142b7870900a480bcbe66ef2cc146f4d /libsolidity
parentc67b559ead9676fb1983e09c512dd9f483c0b6f1 (diff)
downloaddexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.tar
dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.tar.gz
dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.tar.bz2
dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.tar.lz
dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.tar.xz
dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.tar.zst
dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.zip
Validate each tuple literal
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index c2fba565..054912dd 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)
+ 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())