mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4554 from ethereum/indexing-tests
Add comprehensive syntax tests for indexed access
This commit is contained in:
commit
4a61cb5b59
@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
bytes[32] memory a;
|
||||
a[64];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (65-70): Out of bounds array access.
|
@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
bytes memory a;
|
||||
a[];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (61-64): Index expression cannot be omitted.
|
@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
bytes32 b;
|
||||
b[64];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (56-61): Out of bounds array access.
|
@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
bytes32 b;
|
||||
b[];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (56-59): Index expression cannot be omitted.
|
7
test/libsolidity/syntaxTests/indexing/function_type.sol
Normal file
7
test/libsolidity/syntaxTests/indexing/function_type.sol
Normal 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 ())
|
@ -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 ())
|
Loading…
Reference in New Issue
Block a user