mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
defaulting to v0.5.0 behaviour of unary + operator (disallow); also adapting all tests to it
This commit is contained in:
parent
4547b32348
commit
8ca69ed8d8
@ -192,15 +192,9 @@ bool SyntaxChecker::visit(Throw const& _throwStatement)
|
||||
|
||||
bool SyntaxChecker::visit(UnaryOperation const& _operation)
|
||||
{
|
||||
bool const v050 = m_sourceUnit->annotation().experimentalFeatures.count(ExperimentalFeature::V050);
|
||||
|
||||
if (_operation.getOperator() == Token::Add)
|
||||
{
|
||||
if (v050)
|
||||
m_errorReporter.syntaxError(_operation.location(), "Use of unary + is deprecated.");
|
||||
else
|
||||
m_errorReporter.warning(_operation.location(), "Use of unary + is deprecated.");
|
||||
}
|
||||
m_errorReporter.syntaxError(_operation.location(), "Use of unary + is disallowed.");
|
||||
|
||||
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