aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-03-06 21:50:00 +0800
committerchriseth <c@ethdev.com>2017-03-08 19:42:07 +0800
commit93ef7fd260d680cf6e984e286427542e24749bca (patch)
tree0b650eb5c665dce3ba30c5d5407b85900a688da4 /libsolidity
parent276229cc58e00dabeb1c7d800e91131816969a02 (diff)
downloaddexon-solidity-93ef7fd260d680cf6e984e286427542e24749bca.tar.gz
dexon-solidity-93ef7fd260d680cf6e984e286427542e24749bca.tar.zst
dexon-solidity-93ef7fd260d680cf6e984e286427542e24749bca.zip
Disallow compound assignment for tuples.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp5
1 files changed, 5 insertions, 0 deletions
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<TupleType const*>(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<TupleType>();
expectType(_assignment.rightHandSide(), *tupleType);