From 4be9b409de4358b7114e7c00719bf6cbc7267e5a Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 3 Dec 2020 15:03:06 +0100 Subject: [PATCH] Remove unary plus. --- libsolidity/analysis/ConstantEvaluator.cpp | 2 -- .../nameAndTypeResolution/308_rational_unary_plus_operation.sol | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libsolidity/analysis/ConstantEvaluator.cpp b/libsolidity/analysis/ConstantEvaluator.cpp index 8a5fb8a66..fdb414c5e 100644 --- a/libsolidity/analysis/ConstantEvaluator.cpp +++ b/libsolidity/analysis/ConstantEvaluator.cpp @@ -220,8 +220,6 @@ optional ConstantEvaluator::evaluateUnaryOperator(Token _operator, rat return nullopt; else return ~_input.numerator(); - case Token::Add: - return +_input; case Token::Sub: return -_input; default: 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 8b401c1ae..276c6533d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol @@ -7,3 +7,4 @@ contract test { } // ---- // SyntaxError 9636: (70-75): Use of unary + is disallowed. +// TypeError 4907: (70-75): Unary operator + cannot be applied to type rational_const 13 / 4