aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/syntaxTests/arrayLength/inline_array.sol5
-rw-r--r--test/libsolidity/syntaxTests/arrayLength/parentheses.sol25
-rw-r--r--test/libsolidity/syntaxTests/arrayLength/tuples.sol5
3 files changed, 35 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/arrayLength/inline_array.sol b/test/libsolidity/syntaxTests/arrayLength/inline_array.sol
new file mode 100644
index 00000000..a30745d3
--- /dev/null
+++ b/test/libsolidity/syntaxTests/arrayLength/inline_array.sol
@@ -0,0 +1,5 @@
+contract C {
+ uint[[2]] a15;
+}
+// ----
+// TypeError: (22-25): Invalid array length, expected integer literal or constant expression.
diff --git a/test/libsolidity/syntaxTests/arrayLength/parentheses.sol b/test/libsolidity/syntaxTests/arrayLength/parentheses.sol
new file mode 100644
index 00000000..40f55ad6
--- /dev/null
+++ b/test/libsolidity/syntaxTests/arrayLength/parentheses.sol
@@ -0,0 +1,25 @@
+contract C {
+ uint constant L1 = (2);
+ uint constant L2 = ((2));
+ uint constant L3 = ((((2))));
+ uint constant L4 = (2 + 1);
+ uint constant L5 = ((2 + 1));
+ uint constant L6 = (((2) + ((1))));
+ uint constant L7 = (2 + 1) / 1;
+ uint constant L8 = (2 + ((1))) / (1);
+ uint[L1] a1;
+ uint[L2] a2;
+ uint[L3] a3;
+ uint[L4] a4;
+ uint[L5] a5;
+ uint[L6] a6;
+ uint[L7] a7;
+ uint[L8] a8;
+ uint[(2)] a9;
+ uint[(2 + 1)] a10;
+ uint[(2 + 1) + 1] a11;
+ uint[((2) + 1) + 1] a12;
+ uint[(2 + 1) + ((1))] a13;
+ uint[(((2) + 1)) + (((1)))] a14;
+ uint[((((2) + 1)) + (((1))))%1] a15;
+}
diff --git a/test/libsolidity/syntaxTests/arrayLength/tuples.sol b/test/libsolidity/syntaxTests/arrayLength/tuples.sol
new file mode 100644
index 00000000..bc10b3b5
--- /dev/null
+++ b/test/libsolidity/syntaxTests/arrayLength/tuples.sol
@@ -0,0 +1,5 @@
+contract C {
+ uint[(1,2)] a15;
+}
+// ----
+// TypeError: (22-27): Invalid array length, expected integer literal or constant expression.