aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-07-10 22:28:51 +0800
committerGitHub <noreply@github.com>2018-07-10 22:28:51 +0800
commitdce0da1d1763f8ff96e05c603acf37f03937e079 (patch)
tree7776b83f10dc7035555129f4c4391004d01ca4ff
parent4547b3234893a9f3949130a4e12d86be3b1c0de0 (diff)
parent32b44e10c5393ce28ecff2436ffa421be215f392 (diff)
downloaddexon-solidity-dce0da1d1763f8ff96e05c603acf37f03937e079.tar
dexon-solidity-dce0da1d1763f8ff96e05c603acf37f03937e079.tar.gz
dexon-solidity-dce0da1d1763f8ff96e05c603acf37f03937e079.tar.bz2
dexon-solidity-dce0da1d1763f8ff96e05c603acf37f03937e079.tar.lz
dexon-solidity-dce0da1d1763f8ff96e05c603acf37f03937e079.tar.xz
dexon-solidity-dce0da1d1763f8ff96e05c603acf37f03937e079.tar.zst
dexon-solidity-dce0da1d1763f8ff96e05c603acf37f03937e079.zip
Merge pull request #4408 from ethereum/v050-no-unary-plus
[BREAKING] defaulting to v0.5.0 behaviour of unary + operator (disallow)
-rw-r--r--Changelog.md1
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp10
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol2
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/310_rational_unary_plus_operation_v050.sol10
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/311_rational_unary_plus_assignment_v050.sol9
-rw-r--r--test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/309_rational_unary_plus_assignment.sol)2
6 files changed, 5 insertions, 29 deletions
diff --git a/Changelog.md b/Changelog.md
index a0471ce5..1e92863b 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -38,6 +38,7 @@ Breaking Changes:
* 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.
* 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.
Language Features:
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index cd0dc2a4..63f8fac3 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -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;
}
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol
index eb7c6ea9..f635a214 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol
@@ -6,4 +6,4 @@ contract test {
}
}
// ----
-// Warning: (70-75): Use of unary + is deprecated.
+// SyntaxError: (70-75): Use of unary + is disallowed.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/310_rational_unary_plus_operation_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/310_rational_unary_plus_operation_v050.sol
deleted file mode 100644
index 140655af..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/310_rational_unary_plus_operation_v050.sol
+++ /dev/null
@@ -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.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/311_rational_unary_plus_assignment_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/311_rational_unary_plus_assignment_v050.sol
deleted file mode 100644
index 7e5c0feb..00000000
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/311_rational_unary_plus_assignment_v050.sol
+++ /dev/null
@@ -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.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/309_rational_unary_plus_assignment.sol b/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol
index a5bdd6c8..5646c43b 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/309_rational_unary_plus_assignment.sol
+++ b/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol
@@ -5,4 +5,4 @@ contract test {
}
}
// ----
-// Warning: (70-72): Use of unary + is deprecated.
+// SyntaxError: (70-72): Use of unary + is disallowed.