mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Deprecate use of unary '+'
The unary '+' serves no meaningful purpose in Solidity and it makes it possible to produce typos with dagerous implications (e.g. 'a =+5 '), so we are deprecating it. The SyntaxChecker currently issues warnings on the unary '+' but will still compile it for now.
This commit is contained in:
@@ -3938,12 +3938,21 @@ BOOST_AUTO_TEST_CASE(rational_unary_operation)
|
||||
char const* text = R"(
|
||||
contract test {
|
||||
function f() {
|
||||
ufixed8x16 a = +3.25;
|
||||
ufixed8x16 a = 3.25;
|
||||
fixed8x16 b = -3.25;
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_SUCCESS(text);
|
||||
text = R"(
|
||||
contract test {
|
||||
function f() {
|
||||
ufixed8x16 a = +3.25;
|
||||
fixed8x16 b = -3.25;
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_WARNING(text,"Use of unary + is deprecated");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(leading_zero_rationals_convert)
|
||||
|
||||
Reference in New Issue
Block a user