aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsolidity/ast/Types.cpp7
-rw-r--r--test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol1
2 files changed, 4 insertions, 4 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index c6b4211a..fd8839ca 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -612,10 +612,9 @@ TypeResult IntegerType::unaryOperatorResult(Token _operator) const
// "delete" is ok for all integer types
if (_operator == Token::Delete)
return TypeResult{make_shared<TupleType>()};
- // we allow +, -, ++ and --
- else if (_operator == Token::Add || _operator == Token::Sub ||
- _operator == Token::Inc || _operator == Token::Dec ||
- _operator == Token::BitNot)
+ // we allow -, ++ and --
+ else if (_operator == Token::Sub || _operator == Token::Inc ||
+ _operator == Token::Dec || _operator == Token::BitNot)
return TypeResult{shared_from_this()};
else
return TypeResult{""};
diff --git a/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol b/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol
index 5646c43b..f2542d90 100644
--- a/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol
+++ b/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol
@@ -6,3 +6,4 @@ contract test {
}
// ----
// SyntaxError: (70-72): Use of unary + is disallowed.
+// TypeError: (70-72): Unary operator + cannot be applied to type uint256