aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity/syntaxTests')
-rw-r--r--test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_reference_type.sol3
-rw-r--r--test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponents.sol25
-rw-r--r--test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponentsFromReturn.sol29
-rw-r--r--test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcards.sol24
-rw-r--r--test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcardsFromReturn.sol31
-rw-r--r--test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationComplex.sol8
-rw-r--r--test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationEmpty.sol11
-rw-r--r--test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationSimple.sol10
-rw-r--r--test/libsolidity/syntaxTests/multiVariableDeclaration/oneElementTuple.sol8
-rw-r--r--test/libsolidity/syntaxTests/multiVariableDeclaration/sameNumberOfComponents.sol9
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/232_literal_string_to_storage_pointer.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol19
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol7
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol7
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol7
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol7
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol9
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/246_multi_variable_declaration_wildcards_fail_5.sol6
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol7
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/250_member_access_parser_ambiguity.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/276_invalid_types_in_inline_array.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol13
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_warn.sol10
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/472_unspecified_storage_v050.sol11
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/481_explicit_literal_to_unspecified_string_assignment.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol8
-rw-r--r--test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol6
-rw-r--r--test/libsolidity/syntaxTests/parsing/tuples.sol13
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_dynamic_array.sol7
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_fixed_array.sol8
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_complex.sol18
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_array1.sol11
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_array2.sol11
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_array3.sol11
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_multi_array.sol21
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array1.sol12
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array2.sol12
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array3.sol12
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_multi_array.sol12
-rw-r--r--test/libsolidity/syntaxTests/structs/recursion/struct_definition_not_really_recursive_array.sol4
-rw-r--r--test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol8
-rw-r--r--test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol18
42 files changed, 337 insertions, 136 deletions
diff --git a/test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_reference_type.sol b/test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_reference_type.sol
index bd011f2d..0fbad155 100644
--- a/test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_reference_type.sol
+++ b/test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_reference_type.sol
@@ -4,11 +4,10 @@ contract test {
function f() public {
uint[] storage s1 = a;
uint[] memory s2 = new uint[](42);
- uint[] s3 = b;
+ uint[] storage s3 = b;
s1.push(42);
s2[3] = 12;
s3.push(42);
}
}
// ----
-// Warning: (147-156): Variable is declared as a storage pointer. Use an explicit "storage" keyword to silence this warning.
diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponents.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponents.sol
new file mode 100644
index 00000000..3b05a54c
--- /dev/null
+++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponents.sol
@@ -0,0 +1,25 @@
+contract C {
+ function f() public {
+ uint a = (1,2);
+ uint b = (1,2,3);
+ uint c = (1,2,3,4);
+ }
+ function g() public {
+ (uint a1, uint b1, uint c1, uint d1) = 1;
+ (uint a2, uint b2, uint c2) = 1;
+ (uint a3, uint b3) = 1;
+ }
+ function h() public {
+ (uint a1, uint b1, uint c1, uint d1) = (1,2,3);
+ (uint a2, uint b2, uint c2) = (1,2,3,4);
+ }
+}
+// ----
+// TypeError: (47-61): Different number of components on the left hand side (1) than on the right hand side (2).
+// TypeError: (71-87): Different number of components on the left hand side (1) than on the right hand side (3).
+// TypeError: (97-115): Different number of components on the left hand side (1) than on the right hand side (4).
+// TypeError: (157-197): Different number of components on the left hand side (4) than on the right hand side (1).
+// TypeError: (207-238): Different number of components on the left hand side (3) than on the right hand side (1).
+// TypeError: (248-270): Different number of components on the left hand side (2) than on the right hand side (1).
+// TypeError: (312-358): Different number of components on the left hand side (4) than on the right hand side (3).
+// TypeError: (368-407): Different number of components on the left hand side (3) than on the right hand side (4).
diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponentsFromReturn.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponentsFromReturn.sol
new file mode 100644
index 00000000..7b556350
--- /dev/null
+++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponentsFromReturn.sol
@@ -0,0 +1,29 @@
+contract C {
+ function f() public {
+ uint a = two();
+ uint b = three();
+ uint c = four();
+ }
+ function g() public {
+ (uint a1, uint b1, uint c1, uint d1) = one();
+ (uint a2, uint b2, uint c2) = one();
+ (uint a3, uint b3) = one();
+ }
+ function h() public {
+ (uint a1, uint b1, uint c1, uint d1) = three();
+ (uint a2, uint b2, uint c2) = four();
+ }
+ function one() public pure returns (uint);
+ function two() public pure returns (uint, uint);
+ function three() public pure returns (uint, uint, uint);
+ function four() public pure returns (uint, uint, uint, uint);
+}
+// ----
+// TypeError: (47-61): Different number of components on the left hand side (1) than on the right hand side (2).
+// TypeError: (71-87): Different number of components on the left hand side (1) than on the right hand side (3).
+// TypeError: (97-112): Different number of components on the left hand side (1) than on the right hand side (4).
+// TypeError: (154-198): Different number of components on the left hand side (4) than on the right hand side (1).
+// TypeError: (208-243): Different number of components on the left hand side (3) than on the right hand side (1).
+// TypeError: (253-279): Different number of components on the left hand side (2) than on the right hand side (1).
+// TypeError: (321-367): Different number of components on the left hand side (4) than on the right hand side (3).
+// TypeError: (377-413): Different number of components on the left hand side (3) than on the right hand side (4).
diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcards.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcards.sol
new file mode 100644
index 00000000..b500823d
--- /dev/null
+++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcards.sol
@@ -0,0 +1,24 @@
+contract C {
+ function fn() public pure {
+ (uint a,) = (1,2,3);
+ (,uint b) = (1,2,3);
+ (,uint c,) = (1,2,3,4,5);
+ (uint d, uint e,) = (1,2,3,4);
+ (,uint f, uint g) = (1,2,3,4);
+ (,uint h, uint i,) = (1,2,3);
+ (uint j,) = 1;
+ (,uint k) = 1;
+ (,uint l,) = 1;
+ a;b;c;d;e;f;g;h;i;j;k;l;
+ }
+}
+// ----
+// TypeError: (53-72): Different number of components on the left hand side (2) than on the right hand side (3).
+// TypeError: (82-101): Different number of components on the left hand side (2) than on the right hand side (3).
+// TypeError: (111-135): Different number of components on the left hand side (3) than on the right hand side (5).
+// TypeError: (145-174): Different number of components on the left hand side (3) than on the right hand side (4).
+// TypeError: (184-213): Different number of components on the left hand side (3) than on the right hand side (4).
+// TypeError: (223-251): Different number of components on the left hand side (4) than on the right hand side (3).
+// TypeError: (261-274): Different number of components on the left hand side (2) than on the right hand side (1).
+// TypeError: (284-297): Different number of components on the left hand side (2) than on the right hand side (1).
+// TypeError: (307-321): Different number of components on the left hand side (3) than on the right hand side (1).
diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcardsFromReturn.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcardsFromReturn.sol
new file mode 100644
index 00000000..3224a182
--- /dev/null
+++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcardsFromReturn.sol
@@ -0,0 +1,31 @@
+contract C {
+ function fn() public pure {
+ (uint a,) = three();
+ (,uint b) = three();
+ (,uint c,) = five();
+ (uint d, uint e,) = four();
+ (,uint f, uint g) = four();
+ (,uint h, uint i,) = three();
+ (uint j,) = one();
+ (,uint k) = one();
+ (,uint l,) = one();
+ (,uint m, uint n,) = five();
+ a;b;c;d;e;f;g;h;i;j;k;l;m;n;
+ }
+ function one() public pure returns (uint);
+ function two() public pure returns (uint, uint);
+ function three() public pure returns (uint, uint, uint);
+ function four() public pure returns (uint, uint, uint, uint);
+ function five() public pure returns (uint, uint, uint, uint, uint);
+}
+// ----
+// TypeError: (53-72): Different number of components on the left hand side (2) than on the right hand side (3).
+// TypeError: (82-101): Different number of components on the left hand side (2) than on the right hand side (3).
+// TypeError: (111-130): Different number of components on the left hand side (3) than on the right hand side (5).
+// TypeError: (140-166): Different number of components on the left hand side (3) than on the right hand side (4).
+// TypeError: (176-202): Different number of components on the left hand side (3) than on the right hand side (4).
+// TypeError: (212-240): Different number of components on the left hand side (4) than on the right hand side (3).
+// TypeError: (250-267): Different number of components on the left hand side (2) than on the right hand side (1).
+// TypeError: (277-294): Different number of components on the left hand side (2) than on the right hand side (1).
+// TypeError: (304-322): Different number of components on the left hand side (3) than on the right hand side (1).
+// TypeError: (332-359): Different number of components on the left hand side (4) than on the right hand side (5).
diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationComplex.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationComplex.sol
index a3ce6a74..ba6e9916 100644
--- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationComplex.sol
+++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationComplex.sol
@@ -2,10 +2,10 @@ contract D {
struct S { uint a; uint b; }
}
contract C {
- function f() internal returns (uint, uint, uint, D.S[20] storage, uint) {
- (,,,D.S[10*2] storage x,) = f();
+ function f() internal pure {
+ (,,,D.S[10*2] storage x,) = g();
x;
}
-}
+ function g() internal pure returns (uint, uint, uint, D.S[20] storage x, uint) { x = x; }
+}
// ----
-// Warning: (110-117): This variable is of storage pointer type and might be returned without assignment. This can cause storage corruption. Assign the variable (potentially from itself) to remove this warning.
diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationEmpty.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationEmpty.sol
new file mode 100644
index 00000000..9618958e
--- /dev/null
+++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationEmpty.sol
@@ -0,0 +1,11 @@
+contract C {
+ function f() public pure {
+ (uint a, uint b) = f();
+ (uint c) = f();
+ uint d = f();
+ }
+}
+// ----
+// TypeError: (52-74): Different number of components on the left hand side (2) than on the right hand side (0).
+// TypeError: (84-98): Different number of components on the left hand side (1) than on the right hand side (0).
+// TypeError: (108-120): Different number of components on the left hand side (1) than on the right hand side (0).
diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationSimple.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationSimple.sol
index 8e06322c..a2fcce18 100644
--- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationSimple.sol
+++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationSimple.sol
@@ -1,12 +1,12 @@
contract C {
- function f() internal returns (uint, uint, uint, uint) {
+ function f() internal pure returns (uint, uint, uint, uint) {
(uint a, uint b,,) = f();
a; b;
}
- function g() internal returns (bytes memory, string storage) {
- (bytes memory a, string storage b) = g();
+ function g() internal pure {
+ (bytes memory a, string storage b) = h();
a; b;
}
-}
+ function h() internal pure returns (bytes memory, string storage s) { s = s; }
+}
// ----
-// Warning: (163-169): This variable is of storage pointer type and might be returned without assignment. This can cause storage corruption. Assign the variable (potentially from itself) to remove this warning.
diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/oneElementTuple.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/oneElementTuple.sol
new file mode 100644
index 00000000..562c7c0b
--- /dev/null
+++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/oneElementTuple.sol
@@ -0,0 +1,8 @@
+contract C {
+ function f() public {
+ (uint a,) = (1,);
+ a;
+ }
+}
+// ----
+// TypeError: (59-63): Tuple component cannot be empty.
diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/sameNumberOfComponents.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/sameNumberOfComponents.sol
new file mode 100644
index 00000000..59eb34af
--- /dev/null
+++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/sameNumberOfComponents.sol
@@ -0,0 +1,9 @@
+contract C {
+ function f() public pure {
+ (uint a1, uint b1, uint c1, uint d1) = (1,2,3,4);
+ (uint a2, uint b2, uint c2) = (1,2,3);
+ (uint a3, uint b3) = (1,2);
+ a1; b1; c1; d1; a2; b2; c2; a3; b3;
+ }
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/232_literal_string_to_storage_pointer.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/232_literal_string_to_storage_pointer.sol
index a586dc80..be57144e 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/232_literal_string_to_storage_pointer.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/232_literal_string_to_storage_pointer.sol
@@ -1,6 +1,5 @@
contract C {
- function f() public { string x = "abc"; }
+ function f() public { string storage x = "abc"; }
}
// ----
-// Warning: (39-47): Variable is declared as a storage pointer. Use an explicit "storage" keyword to silence this warning.
-// TypeError: (39-55): Type literal_string "abc" is not implicitly convertible to expected type string storage pointer.
+// TypeError: (39-63): Type literal_string "abc" is not implicitly convertible to expected type string storage pointer.
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
deleted file mode 100644
index 0da5c7ee..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol
+++ /dev/null
@@ -1,19 +0,0 @@
-contract C {
- function three() public returns (uint, uint, uint);
- function two() public returns (uint, uint);
- function none() public;
- function f() public {
- (uint a,) = three();
- (uint b, uint c,) = two();
- (,uint d) = three();
- (,uint e, uint g) = two();
- var (,,) = three();
- var () = none();
- a;b;c;d;e;g;
- }
-}
-// ----
-// 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).
-// Warning: (272-297): Different number of components on the left hand side (3) than on the right hand side (2).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol
deleted file mode 100644
index 0ccbb327..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol
+++ /dev/null
@@ -1,7 +0,0 @@
-contract C {
- function one() public returns (uint);
- function f() public { (uint a, uint b, ) = one(); }
-}
-// ----
-// Warning: (81-107): Different number of components on the left hand side (3) than on the right hand side (1).
-// TypeError: (81-107): Not enough components (1) in value to assign all variables (2).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol
deleted file mode 100644
index 8d5de125..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol
+++ /dev/null
@@ -1,7 +0,0 @@
-contract C {
- function one() public returns (uint);
- function f() public { (uint a, , ) = one(); }
-}
-// ----
-// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1).
-// TypeError: (81-101): Not enough components (1) in value to assign all variables (2).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol
deleted file mode 100644
index 993df9b9..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol
+++ /dev/null
@@ -1,7 +0,0 @@
-contract C {
- function one() public returns (uint);
- function f() public { (, , uint a) = one(); }
-}
-// ----
-// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1).
-// TypeError: (81-101): Not enough components (1) in value to assign all variables (2).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol
deleted file mode 100644
index 0697b789..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol
+++ /dev/null
@@ -1,7 +0,0 @@
-contract C {
- function one() public returns (uint);
- function f() public { (, uint a, uint b) = one(); }
-}
-// ----
-// Warning: (81-107): Different number of components on the left hand side (3) than on the right hand side (1).
-// TypeError: (81-107): Not enough components (1) in value to assign all variables (2).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol
index 95e8cf37..d18c115d 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol
@@ -1,13 +1,10 @@
contract C {
- function f() public {
+ function f() public pure {
uint a = (1);
- (uint b,) = uint8(1);
+ (uint b,) = (uint8(1),2);
(uint c, uint d) = (uint32(1), 2 + a);
- (uint e,) = (uint64(1), 2, b);
+ (uint e, ,) = (uint64(1), 2, b);
a;b;c;d;e;
}
}
// ----
-// Warning: (69-89): Different number of components on the left hand side (2) than on the right hand side (1).
-// Warning: (146-175): Different number of components on the left hand side (2) than on the right hand side (3).
-// Warning: (17-201): Function state mutability can be restricted to pure
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
deleted file mode 100644
index 3d2d0705..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/246_multi_variable_declaration_wildcards_fail_5.sol
+++ /dev/null
@@ -1,6 +0,0 @@
-contract C {
- function one() public returns (uint);
- function f() public { var (,) = one(); }
-}
-// ----
-// 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/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol
deleted file mode 100644
index cc5953db..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol
+++ /dev/null
@@ -1,7 +0,0 @@
-contract C {
- function two() public returns (uint, uint);
- function f() public { (uint a, uint b, uint c) = two(); }
-}
-// ----
-// Warning: (87-119): Different number of components on the left hand side (3) than on the right hand side (2).
-// TypeError: (87-119): Not enough components (2) in value to assign all variables (3).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/250_member_access_parser_ambiguity.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/250_member_access_parser_ambiguity.sol
index f5252180..0ab3c198 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/250_member_access_parser_ambiguity.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/250_member_access_parser_ambiguity.sol
@@ -3,15 +3,14 @@ contract C {
struct S { uint a; uint b; uint[20][20][20] c; R d; }
S data;
function f() public {
- C.S x = data;
+ C.S storage x = data;
C.S memory y;
C.S[10] memory z;
C.S[10];
y.a = 2;
x.c[1][2][3] = 9;
x.d.y[2][2] = 3;
+ z;
}
}
// ----
-// Warning: (150-155): Variable is declared as a storage pointer. Use an explicit "storage" keyword to silence this warning.
-// Warning: (194-210): Unused local variable.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/276_invalid_types_in_inline_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/276_invalid_types_in_inline_array.sol
index 6c8aabd5..03d7266a 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/276_invalid_types_in_inline_array.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/276_invalid_types_in_inline_array.sol
@@ -1,8 +1,7 @@
contract C {
function f() public {
- uint[3] x = [45, 'foo', true];
+ uint[3] memory x = [45, 'foo', true];
}
}
// ----
-// Warning: (47-56): Variable is declared as a storage pointer. Use an explicit "storage" keyword to silence this warning.
-// TypeError: (59-76): Unable to deduce common type for array elements.
+// TypeError: (66-83): Unable to deduce common type for array elements.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol
new file mode 100644
index 00000000..6e401920
--- /dev/null
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol
@@ -0,0 +1,13 @@
+contract C {
+ struct S { uint a; }
+ S m_x;
+ uint[] m_y;
+ function f() view public {
+ S x = m_x;
+ uint[] y = m_y;
+ x; y;
+ }
+}
+// ----
+// TypeError: (104-107): Data location must be specified as either "memory" or "storage".
+// TypeError: (123-131): Data location must be specified as either "memory" or "storage".
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_warn.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_warn.sol
deleted file mode 100644
index aa16a6b4..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_warn.sol
+++ /dev/null
@@ -1,10 +0,0 @@
-contract C {
- struct S { uint a; }
- S x;
- function f() view public {
- S y = x;
- y;
- }
-}
-// ----
-// Warning: (86-89): Variable is declared as a storage pointer. Use an explicit "storage" keyword to silence this warning.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/472_unspecified_storage_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/472_unspecified_storage_v050.sol
deleted file mode 100644
index 179c9931..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/472_unspecified_storage_v050.sol
+++ /dev/null
@@ -1,11 +0,0 @@
-pragma experimental "v0.5.0";
-contract C {
- struct S { uint a; }
- S x;
- function f() view public {
- S y = x;
- y;
- }
-}
-// ----
-// TypeError: (116-119): Data location must be specified as either "memory" or "storage".
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/481_explicit_literal_to_unspecified_string_assignment.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/481_explicit_literal_to_unspecified_string_assignment.sol
index 9801b831..ee56204a 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/481_explicit_literal_to_unspecified_string_assignment.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/481_explicit_literal_to_unspecified_string_assignment.sol
@@ -1,8 +1,7 @@
contract C {
function f() pure public {
- string x = "abc";
+ string storage x = "abc";
}
}
// ----
-// Warning: (52-60): Variable is declared as a storage pointer. Use an explicit "storage" keyword to silence this warning.
-// TypeError: (52-68): Type literal_string "abc" is not implicitly convertible to expected type string storage pointer.
+// TypeError: (52-76): Type literal_string "abc" is not implicitly convertible to expected type string storage pointer.
diff --git a/test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol b/test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol
index 2b35ffda..4c1f96e6 100644
--- a/test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol
+++ b/test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol
@@ -1,8 +1,6 @@
contract c {
- function f() public { c[10] a = 7; uint8[10 * 2] x; }
+ function f() public { c[10] storage a = 7; uint8[10 * 2] storage x; }
}
// ----
-// Warning: (39-46): Variable is declared as a storage pointer. Use an explicit "storage" keyword to silence this warning.
-// Warning: (52-67): Variable is declared as a storage pointer. Use an explicit "storage" keyword to silence this warning.
-// TypeError: (39-50): Type int_const 7 is not implicitly convertible to expected type contract c[10] storage pointer.
-// DeclarationError: (52-67): Uninitialized storage pointer. Did you mean '<type> memory x'?
+// TypeError: (39-58): Type int_const 7 is not implicitly convertible to expected type contract c[10] storage pointer.
+// DeclarationError: (60-83): Uninitialized storage pointer.
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
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_dynamic_array.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_dynamic_array.sol
new file mode 100644
index 00000000..d847f17c
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_dynamic_array.sol
@@ -0,0 +1,7 @@
+contract Test {
+ struct MyStructName {
+ address addr;
+ MyStructName[] x;
+ }
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_fixed_array.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_fixed_array.sol
new file mode 100644
index 00000000..126dda4f
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_fixed_array.sol
@@ -0,0 +1,8 @@
+contract Test {
+ struct MyStructName {
+ address addr;
+ MyStructName[1] x;
+ }
+}
+// ----
+// TypeError: (20-96): Recursive struct definition.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_complex.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_complex.sol
new file mode 100644
index 00000000..6d35a5d3
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_complex.sol
@@ -0,0 +1,18 @@
+contract Test {
+ struct MyStructName1 {
+ address addr;
+ uint256 count;
+ MyStructName4[1] x;
+ }
+ struct MyStructName2 {
+ MyStructName1 x;
+ }
+ struct MyStructName3 {
+ MyStructName2[1] x;
+ }
+ struct MyStructName4 {
+ MyStructName3 x;
+ }
+}
+// ----
+// TypeError: (20-121): Recursive struct definition.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_array1.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_array1.sol
new file mode 100644
index 00000000..10d7de2c
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_array1.sol
@@ -0,0 +1,11 @@
+contract Test {
+ struct MyStructName1 {
+ address addr;
+ uint256 count;
+ MyStructName2[] x;
+ }
+ struct MyStructName2 {
+ MyStructName1 x;
+ }
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_array2.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_array2.sol
new file mode 100644
index 00000000..f20510ca
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_array2.sol
@@ -0,0 +1,11 @@
+contract Test {
+ struct MyStructName1 {
+ address addr;
+ uint256 count;
+ MyStructName2 x;
+ }
+ struct MyStructName2 {
+ MyStructName1[] x;
+ }
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_array3.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_array3.sol
new file mode 100644
index 00000000..69747e71
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_array3.sol
@@ -0,0 +1,11 @@
+contract Test {
+ struct MyStructName1 {
+ address addr;
+ uint256 count;
+ MyStructName2[] x;
+ }
+ struct MyStructName2 {
+ MyStructName1[] x;
+ }
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_multi_array.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_multi_array.sol
new file mode 100644
index 00000000..b3507828
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_dynamic_multi_array.sol
@@ -0,0 +1,21 @@
+contract Test {
+ struct S1 {
+ S2[1][] x;
+ }
+ struct S2 {
+ S1 x;
+ }
+ struct T1 {
+ T2[][1] x;
+ }
+ struct T2 {
+ T1 x;
+ }
+ struct R1 {
+ R2[][] x;
+ }
+ struct R2 {
+ R1 x;
+ }
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array1.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array1.sol
new file mode 100644
index 00000000..2c0b90ec
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array1.sol
@@ -0,0 +1,12 @@
+contract Test {
+ struct MyStructName1 {
+ address addr;
+ uint256 count;
+ MyStructName2[1] x;
+ }
+ struct MyStructName2 {
+ MyStructName1 x;
+ }
+}
+// ----
+// TypeError: (20-121): Recursive struct definition.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array2.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array2.sol
new file mode 100644
index 00000000..3178e569
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array2.sol
@@ -0,0 +1,12 @@
+contract Test {
+ struct MyStructName1 {
+ address addr;
+ uint256 count;
+ MyStructName2 x;
+ }
+ struct MyStructName2 {
+ MyStructName1[1] x;
+ }
+}
+// ----
+// TypeError: (20-118): Recursive struct definition.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array3.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array3.sol
new file mode 100644
index 00000000..e34cf9bc
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_array3.sol
@@ -0,0 +1,12 @@
+contract Test {
+ struct MyStructName1 {
+ address addr;
+ uint256 count;
+ MyStructName2[1] x;
+ }
+ struct MyStructName2 {
+ MyStructName1[1] x;
+ }
+}
+// ----
+// TypeError: (20-121): Recursive struct definition.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_multi_array.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_multi_array.sol
new file mode 100644
index 00000000..ed659b6e
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive_fixed_multi_array.sol
@@ -0,0 +1,12 @@
+contract Test {
+ struct MyStructName1 {
+ address addr;
+ uint256 count;
+ MyStructName2[1][1] x;
+ }
+ struct MyStructName2 {
+ MyStructName1 x;
+ }
+}
+// ----
+// TypeError: (20-124): Recursive struct definition.
diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_not_really_recursive_array.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_not_really_recursive_array.sol
new file mode 100644
index 00000000..b2053b8a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_not_really_recursive_array.sol
@@ -0,0 +1,4 @@
+contract Test {
+ struct S1 { uint a; }
+ struct S2 { S1[1] x; S1[1] y; }
+}
diff --git a/test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol b/test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol
deleted file mode 100644
index 23484567..00000000
--- a/test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol
+++ /dev/null
@@ -1,8 +0,0 @@
-contract C {
- function f() public pure returns (uint, uint, uint, uint) {
- (uint a, uint b,) = f();
- a; b;
- }
-}
-// ----
-// Warning: (76-99): Different number of components on the left hand side (3) than on the right hand side (4).
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..7ed92b58
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/unnamed_tuple_decl.sol
@@ -0,0 +1,18 @@
+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.