diff options
author | Erik Kundt <bitshift@posteo.org> | 2018-04-23 22:20:37 +0800 |
---|---|---|
committer | Erik Kundt <bitshift@posteo.org> | 2018-04-23 23:09:42 +0800 |
commit | b2ff9bc88d50e89419317d54b00e80b4c18a92c7 (patch) | |
tree | 117693a6a9f8cf82ef0618007bdd7b6e65ebd8f1 /libsolidity | |
parent | f2b58de92cdffe9d6e70aff2f0198277a5da335a (diff) | |
download | dexon-solidity-b2ff9bc88d50e89419317d54b00e80b4c18a92c7.tar dexon-solidity-b2ff9bc88d50e89419317d54b00e80b4c18a92c7.tar.gz dexon-solidity-b2ff9bc88d50e89419317d54b00e80b4c18a92c7.tar.bz2 dexon-solidity-b2ff9bc88d50e89419317d54b00e80b4c18a92c7.tar.lz dexon-solidity-b2ff9bc88d50e89419317d54b00e80b4c18a92c7.tar.xz dexon-solidity-b2ff9bc88d50e89419317d54b00e80b4c18a92c7.tar.zst dexon-solidity-b2ff9bc88d50e89419317d54b00e80b4c18a92c7.zip |
Turns it into warning (error for 0.5.0) and adds Changelog entry.
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 2675b7eb..53409e6c 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1406,8 +1406,10 @@ bool TypeChecker::visit(TupleExpression const& _tuple) } else { + bool const v050 = m_scope->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050); bool isPure = true; TypePointer inlineArrayType; + for (size_t i = 0; i < components.size(); ++i) { // Outside of an lvalue-context, the only situation where a component can be empty is (x,). @@ -1420,7 +1422,12 @@ bool TypeChecker::visit(TupleExpression const& _tuple) 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."); + { + if (v050) + m_errorReporter.fatalTypeError(components[i]->location(), "Tuple component cannot be empty."); + else + m_errorReporter.warning(components[i]->location(), "Tuple component cannot be empty."); + } // 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) |