aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-07-13 01:22:38 +0800
committerGitHub <noreply@github.com>2018-07-13 01:22:38 +0800
commit5d8a8f726555361a78dac05a5413558f3f63f7f1 (patch)
tree6b8087793be20959f8f16f17e5683b90e5841e12 /test/libsolidity/syntaxTests
parent6dcafac44e1dc6b6b75b61c65b3f55c4f2af8575 (diff)
parentcc585138bc08ff421a026d08f07020b284d946ce (diff)
downloaddexon-solidity-5d8a8f726555361a78dac05a5413558f3f63f7f1.tar.gz
dexon-solidity-5d8a8f726555361a78dac05a5413558f3f63f7f1.tar.zst
dexon-solidity-5d8a8f726555361a78dac05a5413558f3f63f7f1.zip
Merge pull request #4437 from ethereum/report-empty-var-decls
[BREAKING] Report empty var tuple decls
Diffstat (limited to 'test/libsolidity/syntaxTests')
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol2
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/246_multi_variable_declaration_wildcards_fail_5.sol1
-rw-r--r--test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol19
3 files changed, 22 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol
index 0da5c7ee..f3afd0cc 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol
@@ -13,6 +13,8 @@ contract C {
}
}
// ----
+// SyntaxError: (307-325): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
+// SyntaxError: (335-350): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
// Warning: (179-198): Different number of components on the left hand side (2) than on the right hand side (3).
// Warning: (208-233): Different number of components on the left hand side (3) than on the right hand side (2).
// Warning: (243-262): Different number of components on the left hand side (2) than on the right hand side (3).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/246_multi_variable_declaration_wildcards_fail_5.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/246_multi_variable_declaration_wildcards_fail_5.sol
index 3d2d0705..3599a342 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/246_multi_variable_declaration_wildcards_fail_5.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/246_multi_variable_declaration_wildcards_fail_5.sol
@@ -3,4 +3,5 @@ contract C {
function f() public { var (,) = one(); }
}
// ----
+// SyntaxError: (81-96): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
// TypeError: (81-96): Wildcard both at beginning and end of variable declaration list is only allowed if the number of components is equal.
diff --git a/test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol b/test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol
new file mode 100644
index 00000000..6c1489f5
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol
@@ -0,0 +1,19 @@
+pragma solidity ^0.4.20;
+
+contract C {
+ function f() internal pure {}
+ function g() internal pure returns (uint) { return 1; }
+ function h() internal pure returns (uint, uint) { return (1, 2); }
+
+ function test() internal pure {
+ var () = f();
+ var () = g();
+ var (,) = h();
+ }
+}
+
+// ----
+// SyntaxError: (249-261): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
+// SyntaxError: (271-283): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
+// SyntaxError: (293-306): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
+// TypeError: (271-283): Too many components (1) in value for variable assignment (0) needed