Merge pull request #4554 from ethereum/indexing-tests

Add comprehensive syntax tests for indexed access
This commit is contained in:
Alex Beregszaszi 2018-07-25 10:37:30 +01:00 committed by GitHub
commit 4a61cb5b59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 ())