diff options
author | Erik Kundt <bitshift@posteo.org> | 2018-10-11 05:18:32 +0800 |
---|---|---|
committer | Erik Kundt <bitshift@posteo.org> | 2018-10-11 05:18:32 +0800 |
commit | 3e24a3d81b2ff0dd7a2a55235bdd1b6aa417773b (patch) | |
tree | 61a05e5ce38a6717582bc4426e919ed6369dbc2a /test/libsolidity | |
parent | 2feaacba9d02a1cc789873c8d58188055574c1bb (diff) | |
download | dexon-solidity-3e24a3d81b2ff0dd7a2a55235bdd1b6aa417773b.tar.gz dexon-solidity-3e24a3d81b2ff0dd7a2a55235bdd1b6aa417773b.tar.zst dexon-solidity-3e24a3d81b2ff0dd7a2a55235bdd1b6aa417773b.zip |
Adds syntax tests for array index access.
Diffstat (limited to 'test/libsolidity')
5 files changed, 31 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/array/length/bytes32_too_large.sol b/test/libsolidity/syntaxTests/array/length/bytes32_too_large.sol new file mode 100644 index 00000000..1742c80d --- /dev/null +++ b/test/libsolidity/syntaxTests/array/length/bytes32_too_large.sol @@ -0,0 +1,5 @@ +contract C { + bytes32[8**90] ids; +} +// ---- +// TypeError: (25-30): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/bytes32_too_large_multidim.sol b/test/libsolidity/syntaxTests/array/length/bytes32_too_large_multidim.sol new file mode 100644 index 00000000..1344574c --- /dev/null +++ b/test/libsolidity/syntaxTests/array/length/bytes32_too_large_multidim.sol @@ -0,0 +1,5 @@ +contract C { + bytes32[8**90][500] ids; +} +// ---- +// TypeError: (25-30): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/array/length/uint_too_large_multidim.sol b/test/libsolidity/syntaxTests/array/length/uint_too_large_multidim.sol new file mode 100644 index 00000000..901bc28a --- /dev/null +++ b/test/libsolidity/syntaxTests/array/length/uint_too_large_multidim.sol @@ -0,0 +1,5 @@ +contract C { + uint[8**90][500] ids; +} +// ---- +// TypeError: (22-27): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/indexing/array_negative_index.sol b/test/libsolidity/syntaxTests/indexing/array_negative_index.sol new file mode 100644 index 00000000..019d023b --- /dev/null +++ b/test/libsolidity/syntaxTests/indexing/array_negative_index.sol @@ -0,0 +1,8 @@ +contract C { + function f() public { + bytes[32] memory a; + a[-1]; + } +} +// ---- +// TypeError: (67-69): Type int_const -1 is not implicitly convertible to expected type uint256. diff --git a/test/libsolidity/syntaxTests/indexing/array_noninteger_index.sol b/test/libsolidity/syntaxTests/indexing/array_noninteger_index.sol new file mode 100644 index 00000000..7c0ac9fe --- /dev/null +++ b/test/libsolidity/syntaxTests/indexing/array_noninteger_index.sol @@ -0,0 +1,8 @@ +contract C { + function f() public { + bytes[32] memory a; + a[888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888]; + } +} +// ---- +// TypeError: (67-178): Type int_const 8888...(103 digits omitted)...8888 is not implicitly convertible to expected type uint256. |