diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index db88f20bf..f0248538e 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1288,6 +1288,9 @@ void TypeChecker::checkExpressionAssignment(Type const& _type, Expression const& { if (auto const* tupleExpression = dynamic_cast(&_expression)) { + if (tupleExpression->components().empty()) + m_errorReporter.typeError(_expression.location(), "Empty tuple on the left hand side."); + auto const* tupleType = dynamic_cast(&_type); auto const& types = tupleType && tupleExpression->components().size() != 1 ? tupleType->components() : vector { &_type }; diff --git a/test/libsolidity/syntaxTests/tupleAssignments/empty_tuples_lhs.sol b/test/libsolidity/syntaxTests/tupleAssignments/empty_tuples_lhs.sol index 390a3636a..a771f630a 100644 --- a/test/libsolidity/syntaxTests/tupleAssignments/empty_tuples_lhs.sol +++ b/test/libsolidity/syntaxTests/tupleAssignments/empty_tuples_lhs.sol @@ -16,9 +16,14 @@ contract C { } } // ---- +// TypeError: (41-43): Empty tuple on the left hand side. // TypeError: (47-48): Type int_const 2 is not implicitly convertible to expected type tuple(). +// TypeError: (86-88): Empty tuple on the left hand side. +// TypeError: (173-175): Empty tuple on the left hand side. // TypeError: (178-182): Type tuple(uint256,uint256) is not implicitly convertible to expected type tuple(). // TypeError: (166-182): Different number of arguments in return statement than in returns declaration. +// TypeError: (229-231): Empty tuple on the left hand side. +// TypeError: (401-404): Empty tuple on the left hand side. // TypeError: (399-466): Compound assignment is not allowed for tuple types. // TypeError: (410-466): Type bytes32 is not implicitly convertible to expected type tuple(). // TypeError: (389-396): No matching declaration found after argument-dependent lookup.