Add comprehensive syntax tests for indexed access

This commit is contained in:
Alex Beregszaszi 2018-07-24 00:19:12 +01:00
parent ae0959ae12
commit 1dbf2d1923
6 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,8 @@
contract C {
function f() public {
bytes[32] memory a;
a[64];
}
}
// ----
// TypeError: (65-70): Out of bounds array access.

View File

@ -0,0 +1,8 @@
contract C {
function f() public {
bytes memory a;
a[];
}
}
// ----
// TypeError: (61-64): Index expression cannot be omitted.

View File

@ -0,0 +1,8 @@
contract C {
function f() public {
bytes32 b;
b[64];
}
}
// ----
// TypeError: (56-61): Out of bounds array access.

View File

@ -0,0 +1,8 @@
contract C {
function f() public {
bytes32 b;
b[];
}
}
// ----
// TypeError: (56-59): Index expression cannot be omitted.

View File

@ -0,0 +1,7 @@
contract C {
function f() public {
f[0];
}
}
// ----
// TypeError: (41-42): Indexed expression has to be a type, mapping or array (is function ())

View File

@ -0,0 +1,7 @@
contract C {
function f() public {
f[];
}
}
// ----
// TypeError: (41-42): Indexed expression has to be a type, mapping or array (is function ())