diff options
author | chriseth <chris@ethereum.org> | 2018-10-11 17:59:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-11 17:59:01 +0800 |
commit | 81a385eceec10e6e7455338370362079568d4b1d (patch) | |
tree | b34dd3241e66ac4fac32321e996f94a881b7db74 | |
parent | 6b5d041e06540f3b2d2ac4e6db167defdbdbe15a (diff) | |
parent | 3e24a3d81b2ff0dd7a2a55235bdd1b6aa417773b (diff) | |
download | dexon-solidity-81a385eceec10e6e7455338370362079568d4b1d.tar dexon-solidity-81a385eceec10e6e7455338370362079568d4b1d.tar.gz dexon-solidity-81a385eceec10e6e7455338370362079568d4b1d.tar.bz2 dexon-solidity-81a385eceec10e6e7455338370362079568d4b1d.tar.lz dexon-solidity-81a385eceec10e6e7455338370362079568d4b1d.tar.xz dexon-solidity-81a385eceec10e6e7455338370362079568d4b1d.tar.zst dexon-solidity-81a385eceec10e6e7455338370362079568d4b1d.zip |
Merge pull request #5197 from ethereum/array-index-tests
More array index tests
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. |