diff --git a/test/libsolidity/semanticTests/literals/denominations_in_array_sizes.sol b/test/libsolidity/semanticTests/literals/denominations_in_array_sizes.sol new file mode 100644 index 000000000..43a09af05 --- /dev/null +++ b/test/libsolidity/semanticTests/literals/denominations_in_array_sizes.sol @@ -0,0 +1,25 @@ +contract C { + uint[2 wei] a; + uint[2 gwei] b; + uint[2 ether] c; + uint[2 seconds] d; + uint[2 minutes] e; + uint[2 hours] f; + uint[2 days] g; + uint[2 weeks] h; + + function lengths() public returns (uint, uint, uint, uint, uint, uint, uint, uint) { + return ( + a.length, + b.length, + c.length, + d.length, + e.length, + f.length, + g.length, + h.length + ); + } +} +// ---- +// lengths() -> 2, 2000000000, 2000000000000000000, 2, 120, 7200, 172800, 1209600 diff --git a/test/libsolidity/syntaxTests/denominations/denominations_in_array_sizes.sol b/test/libsolidity/syntaxTests/denominations/denominations_in_array_sizes.sol new file mode 100644 index 000000000..46c7a0d87 --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/denominations_in_array_sizes.sol @@ -0,0 +1,12 @@ +contract C { + uint[42 wei] a; + uint[42 gwei] b; + uint[42 ether] c; + uint[42 seconds] d; + uint[42 minutes] e; + uint[42 hours] f; + uint[42 days] g; + uint[42 weeks] h; +} +// ---- +// Warning 7325: (58-72): Type uint256[42000000000000000000] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.