aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-07-10 18:37:09 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-07-10 21:27:46 +0800
commita6e5a51d6178b8b06053bea35cc984472bd48684 (patch)
tree8005a6bf63967ffebf6376ebd1f29bcc3b3d8a4d
parentd9c3b10b1c5ad5d9dffbaceb48cd99e7293a6c56 (diff)
downloaddexon-solidity-a6e5a51d6178b8b06053bea35cc984472bd48684.tar.gz
dexon-solidity-a6e5a51d6178b8b06053bea35cc984472bd48684.tar.zst
dexon-solidity-a6e5a51d6178b8b06053bea35cc984472bd48684.zip
Disallow empty tuple components.
-rw-r--r--libsolidity/analysis/TypeChecker.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 20e423e6..ac11bb63 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -1411,14 +1411,12 @@ 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,).
- if (!components[i] && !(i == 1 && components.size() == 2))
+ if (!components[i])
m_errorReporter.fatalTypeError(_tuple.location(), "Tuple component cannot be empty.");
else if (components[i])
{
@@ -1430,10 +1428,7 @@ bool TypeChecker::visit(TupleExpression const& _tuple)
{
if (_tuple.isInlineArray())
m_errorReporter.fatalTypeError(components[i]->location(), "Array component cannot be empty.");
- 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.");
+ m_errorReporter.typeError(components[i]->location(), "Tuple component cannot be empty.");
}
// Note: code generation will visit each of the expression even if they are not assigned from.