diff options
author | Rhett Aultman <rhett.aultman@meraki.net> | 2017-09-20 23:52:10 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-30 00:50:25 +0800 |
commit | e434437eb71e03483232a55aac8c53928fe63d38 (patch) | |
tree | 637552965700a6a3d350f2a2626a7d46ab5c3762 /test/libsolidity | |
parent | 466cce58dffc66054e9df223f49a9219e6f5f4cd (diff) | |
download | dexon-solidity-e434437eb71e03483232a55aac8c53928fe63d38.tar.gz dexon-solidity-e434437eb71e03483232a55aac8c53928fe63d38.tar.zst dexon-solidity-e434437eb71e03483232a55aac8c53928fe63d38.zip |
Unary + now a synax error (experimental 0.5.0)
The unary + was deprecated with a warning, but will be elevated to an
error in 0.5.0. This adds the syntax error for the 0.5.0 pragma, and
for a true 0.5.0 release we should consider removing the operator from
the parser.
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 91c2adb1..c3a1ce08 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -4135,6 +4135,8 @@ BOOST_AUTO_TEST_CASE(rational_unary_operation) } )"; CHECK_SUCCESS_NO_WARNINGS(text); + + // Test deprecation warning under < 0.5.0 text = R"( contract test { function f() pure public { @@ -4154,6 +4156,29 @@ BOOST_AUTO_TEST_CASE(rational_unary_operation) } )"; CHECK_WARNING(text,"Use of unary + is deprecated"); + + // Test syntax error under 0.5.0 + text = R"( + pragma experimental "v0.5.0"; + contract test { + function f() pure public { + ufixed16x2 a = +3.25; + fixed16x2 b = -3.25; + a; b; + } + } + )"; + CHECK_ERROR(text, SyntaxError, "Use of unary + is deprecated"); + text = R"( + pragma experimental "v0.5.0"; + contract test { + function f(uint x) pure public { + uint y = +x; + y; + } + } + )"; + CHECK_ERROR(text, SyntaxError, "Use of unary + is deprecated"); } BOOST_AUTO_TEST_CASE(leading_zero_rationals_convert) |