From 93ef7fd260d680cf6e984e286427542e24749bca Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 6 Mar 2017 14:50:00 +0100 Subject: Disallow compound assignment for tuples. --- libsolidity/analysis/TypeChecker.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libsolidity/analysis') diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 93b183a2..acceffda 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -947,6 +947,11 @@ bool TypeChecker::visit(Assignment const& _assignment) _assignment.annotation().type = t; if (TupleType const* tupleType = dynamic_cast(t.get())) { + if (_assignment.assignmentOperator() != Token::Assign) + typeError( + _assignment.location(), + "Compound assignment is not allowed for tuple types." + ); // Sequenced assignments of tuples is not valid, make the result a "void" type. _assignment.annotation().type = make_shared(); expectType(_assignment.rightHandSide(), *tupleType); -- cgit