aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorErik Kundt <bitshift@posteo.org>2018-04-22 22:54:33 +0800
committerErik Kundt <bitshift@posteo.org>2018-04-22 22:54:33 +0800
commitf2b58de92cdffe9d6e70aff2f0198277a5da335a (patch)
treef59cb999beb8a37d9b7a316702a9bb785a790ec6 /libsolidity
parentd674cde34cc0f9a8e8a520c8eddd2090384fb739 (diff)
downloaddexon-solidity-f2b58de92cdffe9d6e70aff2f0198277a5da335a.tar.gz
dexon-solidity-f2b58de92cdffe9d6e70aff2f0198277a5da335a.tar.zst
dexon-solidity-f2b58de92cdffe9d6e70aff2f0198277a5da335a.zip
Prevents null type from being used in tuple.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 66b0af58..2675b7eb 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -1418,6 +1418,10 @@ bool TypeChecker::visit(TupleExpression const& _tuple)
components[i]->accept(*this);
types.push_back(type(*components[i]));
+ if (types[i]->category() == Type::Category::Tuple)
+ if (dynamic_cast<TupleType const&>(*types[i]).components().empty())
+ m_errorReporter.fatalTypeError(components[i]->location(), "Type of tuple component cannot be null.");
+
// 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())