mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4408 from ethereum/v050-no-unary-plus
[BREAKING] defaulting to v0.5.0 behaviour of unary + operator (disallow)
This commit is contained in:
commit
dce0da1d17
@ -38,6 +38,7 @@ Breaking Changes:
|
|||||||
* Type Checker: Only accept a single ``bytes`` type for ``.call()`` (and family), ``keccak256()``, ``sha256()`` and ``ripemd160()``.
|
* Type Checker: Only accept a single ``bytes`` type for ``.call()`` (and family), ``keccak256()``, ``sha256()`` and ``ripemd160()``.
|
||||||
* Remove obsolete ``std`` directory from the Solidity repository. This means accessing ``https://github.com/ethereum/soldity/blob/develop/std/*.sol`` (or ``https://github.com/ethereum/solidity/std/*.sol`` in Remix) will not be possible.
|
* Remove obsolete ``std`` directory from the Solidity repository. This means accessing ``https://github.com/ethereum/soldity/blob/develop/std/*.sol`` (or ``https://github.com/ethereum/solidity/std/*.sol`` in Remix) will not be possible.
|
||||||
* Syntax Checker: Named return values in function types are an error.
|
* Syntax Checker: Named return values in function types are an error.
|
||||||
|
* Syntax Checker: Disallow unary ``+``. This was already the case in the experimental 0.5.0 mode.
|
||||||
* View Pure Checker: Strictly enfore state mutability. This was already the case in the experimental 0.5.0 mode.
|
* View Pure Checker: Strictly enfore state mutability. This was already the case in the experimental 0.5.0 mode.
|
||||||
|
|
||||||
Language Features:
|
Language Features:
|
||||||
|
@ -192,15 +192,9 @@ bool SyntaxChecker::visit(Throw const& _throwStatement)
|
|||||||
|
|
||||||
bool SyntaxChecker::visit(UnaryOperation const& _operation)
|
bool SyntaxChecker::visit(UnaryOperation const& _operation)
|
||||||
{
|
{
|
||||||
bool const v050 = m_sourceUnit->annotation().experimentalFeatures.count(ExperimentalFeature::V050);
|
|
||||||
|
|
||||||
if (_operation.getOperator() == Token::Add)
|
if (_operation.getOperator() == Token::Add)
|
||||||
{
|
m_errorReporter.syntaxError(_operation.location(), "Use of unary + is disallowed.");
|
||||||
if (v050)
|
|
||||||
m_errorReporter.syntaxError(_operation.location(), "Use of unary + is deprecated.");
|
|
||||||
else
|
|
||||||
m_errorReporter.warning(_operation.location(), "Use of unary + is deprecated.");
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,4 +6,4 @@ contract test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// Warning: (70-75): Use of unary + is deprecated.
|
// SyntaxError: (70-75): Use of unary + is disallowed.
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
pragma experimental "v0.5.0";
|
|
||||||
contract test {
|
|
||||||
function f() pure public {
|
|
||||||
ufixed16x2 a = +3.25;
|
|
||||||
fixed16x2 b = -3.25;
|
|
||||||
a; b;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ----
|
|
||||||
// SyntaxError: (100-105): Use of unary + is deprecated.
|
|
@ -1,9 +0,0 @@
|
|||||||
pragma experimental "v0.5.0";
|
|
||||||
contract test {
|
|
||||||
function f(uint x) pure public {
|
|
||||||
uint y = +x;
|
|
||||||
y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ----
|
|
||||||
// SyntaxError: (100-102): Use of unary + is deprecated.
|
|
@ -5,4 +5,4 @@ contract test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// Warning: (70-72): Use of unary + is deprecated.
|
// SyntaxError: (70-72): Use of unary + is disallowed.
|
Loading…
Reference in New Issue
Block a user