diff options
author | chriseth <chris@ethereum.org> | 2018-04-24 18:12:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-24 18:12:03 +0800 |
commit | d1e1293fbd852149edfd03fd6b2e54c8c4c6e5f9 (patch) | |
tree | e389bf6c004e88917e91e6c93669b058ac129521 /test/libsolidity/syntaxTests | |
parent | 258ae8927e21cddc18935e26b4184a833c85bda8 (diff) | |
parent | 1ac0090f31d12a720950991ab4e85710877effd1 (diff) | |
download | dexon-solidity-d1e1293fbd852149edfd03fd6b2e54c8c4c6e5f9.tar dexon-solidity-d1e1293fbd852149edfd03fd6b2e54c8c4c6e5f9.tar.gz dexon-solidity-d1e1293fbd852149edfd03fd6b2e54c8c4c6e5f9.tar.bz2 dexon-solidity-d1e1293fbd852149edfd03fd6b2e54c8c4c6e5f9.tar.lz dexon-solidity-d1e1293fbd852149edfd03fd6b2e54c8c4c6e5f9.tar.xz dexon-solidity-d1e1293fbd852149edfd03fd6b2e54c8c4c6e5f9.tar.zst dexon-solidity-d1e1293fbd852149edfd03fd6b2e54c8c4c6e5f9.zip |
Merge pull request #3981 from ethereum/years-suffix
The "year" denomination is deprecated
Diffstat (limited to 'test/libsolidity/syntaxTests')
6 files changed, 35 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination.sol b/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination.sol new file mode 100644 index 00000000..3571e8a9 --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination.sol @@ -0,0 +1,5 @@ +contract C { + uint constant x = 0x01 wei; +} +// ---- +// Warning: (32-40): Hexadecimal numbers with unit denominations are deprecated. You can use an expression of the form "0x1234 * 1 day" instead. diff --git a/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination_050.sol b/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination_050.sol new file mode 100644 index 00000000..98865999 --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination_050.sol @@ -0,0 +1,6 @@ +pragma experimental "v0.5.0"; +contract C { + uint constant x = 0x01 wei; +} +// ---- +// TypeError: (62-70): Hexadecimal numbers cannot be used with unit denominations. You can use an expression of the form "0x1234 * 1 day" instead. diff --git a/test/libsolidity/syntaxTests/denominations/denominations.sol b/test/libsolidity/syntaxTests/denominations/denominations.sol new file mode 100644 index 00000000..6d1aa2f3 --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/denominations.sol @@ -0,0 +1,7 @@ +contract C { + uint constant a = 1 wei + 2 szabo + 3 finney + 4 ether; + uint constant b = 1 seconds + 2 minutes + 3 hours + 4 days + 5 weeks + 6 years; + uint constant c = 2 szabo / 1 seconds + 3 finney * 3 hours; +} +// ---- +// Warning: (142-149): Using "years" as a unit denomination is deprecated. diff --git a/test/libsolidity/syntaxTests/denominations/deprecated_year.sol b/test/libsolidity/syntaxTests/denominations/deprecated_year.sol new file mode 100644 index 00000000..30e86535 --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/deprecated_year.sol @@ -0,0 +1,5 @@ +contract C { + uint constant a = 3 years; +} +// ---- +// Warning: (32-39): Using "years" as a unit denomination is deprecated. diff --git a/test/libsolidity/syntaxTests/denominations/deprecated_year_050.sol b/test/libsolidity/syntaxTests/denominations/deprecated_year_050.sol new file mode 100644 index 00000000..4baaeaa3 --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/deprecated_year_050.sol @@ -0,0 +1,6 @@ +pragma experimental "v0.5.0"; +contract C { + uint constant a = 3 years; +} +// ---- +// TypeError: (62-69): Using "years" as a unit denomination is deprecated. diff --git a/test/libsolidity/syntaxTests/denominations/fixed_point_division.sol b/test/libsolidity/syntaxTests/denominations/fixed_point_division.sol new file mode 100644 index 00000000..22331b51 --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/fixed_point_division.sol @@ -0,0 +1,6 @@ +contract C { + uint constant a = 4 ether / 3 hours; + ufixed constant b = ufixed(4 ether / 3 hours); +} +// ---- +// TypeError: (32-49): Type rational_const 10000000000000000 / 27 is not implicitly convertible to expected type uint256. Try converting to type ufixed256x62 or use an explicit conversion. |