diff options
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 01de5eb0..2d6b6151 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -779,6 +779,7 @@ bool TypeChecker::visit(Assignment const& _assignment) bool TypeChecker::visit(TupleExpression const& _tuple) { + vector<ASTPointer<Expression>> const& components = _tuple.components(); TypePointers types; if (_tuple.annotation().lValueRequested) @@ -791,7 +792,10 @@ bool TypeChecker::visit(TupleExpression const& _tuple) } else types.push_back(TypePointer()); - _tuple.annotation().type = make_shared<TupleType>(types); + if (_tuple.isInlineArray()) + _tuple.annotation().type = make_shared<ArrayType>(DataLocation::Storage, _tuple.annotation().type, types.size()); + else + _tuple.annotation().type = make_shared<TupleType>(types); // If some of the components are not LValues, the error is reported above. _tuple.annotation().isLValue = true; } @@ -801,7 +805,10 @@ bool TypeChecker::visit(TupleExpression const& _tuple) { // Outside of an lvalue-context, the only situation where a component can be empty is (x,). if (!components[i] && !(i == 1 && components.size() == 2)) - fatalTypeError(_tuple.location(), "Tuple component cannot be empty."); + _tuple.isInlineArray() ? + fatalTypeError(_tuple.location(), "Array component cannot have empty cells.") + : + fatalTypeError(_tuple.location(), "Tuple component cannot be empty."); else if (components[i]) { components[i]->accept(*this); |