aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-03-02 18:11:16 +0800
committerGitHub <noreply@github.com>2018-03-02 18:11:16 +0800
commitf78d6a9a1ed623c4217762502532b3ceeef3cce8 (patch)
tree5e2b3b0e299b7f7056f960fd16f784dd2252b9af /test
parentc9840c98f45e6fa9258ec4624219622f5f71c75c (diff)
parent454b470ceed799cb22ceaef6ea2b0bbea7165df9 (diff)
downloaddexon-solidity-f78d6a9a1ed623c4217762502532b3ceeef3cce8.tar.gz
dexon-solidity-f78d6a9a1ed623c4217762502532b3ceeef3cce8.tar.zst
dexon-solidity-f78d6a9a1ed623c4217762502532b3ceeef3cce8.zip
Merge pull request #3628 from ethereum/literalsHexUnit
Deprecate using unit denominations in combination with hex numbers.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 8c2d853c..eeefe818 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -2717,6 +2717,25 @@ BOOST_AUTO_TEST_CASE(explicit_conversion_from_decimal_to_bytesxx)
CHECK_SUCCESS_NO_WARNINGS(text);
}
+BOOST_AUTO_TEST_CASE(combining_hex_and_denomination)
+{
+ char const* text = R"(
+ contract Foo {
+ uint constant x = 0x01 wei;
+ }
+ )";
+ CHECK_WARNING(text, "Hexadecimal numbers with unit denominations are deprecated.");
+
+ char const* textV050 = R"(
+ pragma experimental "v0.5.0";
+
+ contract Foo {
+ uint constant x = 0x01 wei;
+ }
+ )";
+ CHECK_ERROR(textV050, TypeError, "Hexadecimal numbers cannot be used with unit denominations.");
+}
+
BOOST_AUTO_TEST_CASE(assigning_value_to_const_variable)
{
char const* text = R"(