aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests/parsing
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-07-13 07:23:28 +0800
committerGitHub <noreply@github.com>2018-07-13 07:23:28 +0800
commit052f19c6b0aac3b4f60ee8a7f340033e0b5350f0 (patch)
tree82027ba467f6851c64984c77538ee424ae74f645 /test/libsolidity/syntaxTests/parsing
parentf0bc1bce895f67ccd8b21e244d1b7cbd8c8f9453 (diff)
parent62645d530253c365ac09979135e9037f2bde2934 (diff)
downloaddexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.tar
dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.tar.gz
dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.tar.bz2
dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.tar.lz
dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.tar.xz
dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.tar.zst
dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.zip
Merge pull request #4431 from ethereum/tupleDeclaration
Disallow multi variable declarations with mismatching number of values.
Diffstat (limited to 'test/libsolidity/syntaxTests/parsing')
-rw-r--r--test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol6
-rw-r--r--test/libsolidity/syntaxTests/parsing/tuples.sol13
2 files changed, 6 insertions, 13 deletions
diff --git a/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol b/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol
index 1984ed36..56c2e280 100644
--- a/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol
+++ b/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol
@@ -2,8 +2,8 @@ contract C {
function f() pure public {
(uint a, uint b, uint c) = g();
(uint d) = 2;
- (, uint e) = 3;
- (uint h,) = 4;
+ (, uint e) = (3,4);
+ (uint h,) = (4,5);
(uint x,,) = g();
(, uint y,) = g();
a; b; c; d; e; h; x; y;
@@ -11,5 +11,3 @@ contract C {
function g() pure public returns (uint, uint, uint) {}
}
// ----
-// Warning: (93-107): Different number of components on the left hand side (2) than on the right hand side (1).
-// Warning: (111-124): Different number of components on the left hand side (2) than on the right hand side (1).
diff --git a/test/libsolidity/syntaxTests/parsing/tuples.sol b/test/libsolidity/syntaxTests/parsing/tuples.sol
index ca2f9d6b..875556e9 100644
--- a/test/libsolidity/syntaxTests/parsing/tuples.sol
+++ b/test/libsolidity/syntaxTests/parsing/tuples.sol
@@ -1,16 +1,11 @@
contract C {
- function f() public {
+ function f() public pure {
uint a = (1);
- (uint b,) = 1;
+ (uint b,) = (1,2);
(uint c, uint d) = (1, 2 + a);
- (uint e,) = (1, 2, b);
+ (uint e,) = (1, b);
(a) = 3;
+ a;b;c;d;e;
}
}
// ----
-// Warning: (54-67): Different number of components on the left hand side (2) than on the right hand side (1).
-// Warning: (104-125): Different number of components on the left hand side (2) than on the right hand side (3).
-// Warning: (72-78): Unused local variable.
-// Warning: (80-86): Unused local variable.
-// Warning: (105-111): Unused local variable.
-// Warning: (14-140): Function state mutability can be restricted to pure