aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsolidity/ASTAnnotations.h2
-rw-r--r--libsolidity/Types.cpp5
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp25
-rw-r--r--test/libsolidity/SolidityParser.cpp2
4 files changed, 31 insertions, 3 deletions
diff --git a/libsolidity/ASTAnnotations.h b/libsolidity/ASTAnnotations.h
index 32602628..1b772ffa 100644
--- a/libsolidity/ASTAnnotations.h
+++ b/libsolidity/ASTAnnotations.h
@@ -86,7 +86,7 @@ struct UserDefinedTypeNameAnnotation: TypeNameAnnotation
struct VariableDeclarationStatementAnnotation: ASTAnnotation
{
- /// Information about which component of the vaule is assigned to which variable.
+ /// Information about which component of the value is assigned to which variable.
/// The pointer can be null to signify that the component is discarded.
std::vector<VariableDeclaration const*> assignments;
};
diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp
index 3d80a163..c800e288 100644
--- a/libsolidity/Types.cpp
+++ b/libsolidity/Types.cpp
@@ -1244,8 +1244,9 @@ string TupleType::toString(bool _short) const
u256 TupleType::storageSize() const
{
BOOST_THROW_EXCEPTION(
- InternalCompilerError()
- << errinfo_comment("Storage size of non-storable tuple type requested."));
+ InternalCompilerError() <<
+ errinfo_comment("Storage size of non-storable tuple type requested.")
+ );
}
unsigned TupleType::sizeOnStack() const
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 4316c6a8..b4810af7 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -2411,11 +2411,14 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fine)
contract C {
function three() returns (uint, uint, uint);
function two() returns (uint, uint);
+ function none();
function f() {
var (a,) = three();
var (b,c,) = two();
var (,d) = three();
var (,e,g) = two();
+ var (,,) = three();
+ var () = none();
}
)";
BOOST_CHECK_NO_THROW(parseAndAnalyseReturnError(text));
@@ -2464,6 +2467,28 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_4)
SOLIDITY_CHECK_ERROR_TYPE(parseAndAnalyseReturnError(text), TypeError);
}
+BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_5)
+{
+ char const* text = R"(
+ contract C {
+ function one() returns (uint);
+ function f() { var (,) = one(); }
+ }
+ )";
+ SOLIDITY_CHECK_ERROR_TYPE(parseAndAnalyseReturnError(text), TypeError);
+}
+
+BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_6)
+{
+ char const* text = R"(
+ contract C {
+ function two() returns (uint, uint);
+ function f() { var (a, b, c) = two(); }
+ }
+ )";
+ SOLIDITY_CHECK_ERROR_TYPE(parseAndAnalyseReturnError(text), TypeError);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}
diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp
index 569530b9..03930479 100644
--- a/test/libsolidity/SolidityParser.cpp
+++ b/test/libsolidity/SolidityParser.cpp
@@ -945,6 +945,8 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration)
var (f,) = 4;
var (x,,) = g();
var (,y,) = g();
+ var () = g();
+ var (,,) = g();
}
function g() returns (uint, uint, uint) {}
}