From 584a76cd09f75f7123f6650e1a8c652c11c1d38d Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 28 Jul 2021 16:32:22 +0200 Subject: [PATCH] No operators on fixed point types beyond comparison. --- libsolidity/ast/Types.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 9d74c8832..ecb9f3cd3 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -733,8 +733,7 @@ TypeResult FixedPointType::unaryOperatorResult(Token _operator) const case Token::Sub: case Token::Inc: case Token::Dec: - // for fixed, we allow +, -, ++ and -- - return this; + return TypeResult::err("Arithmetic operators on fixed point types are not yet supported."); default: return nullptr; } @@ -795,7 +794,8 @@ TypeResult FixedPointType::binaryOperatorResult(Token _operator, Type const* _ot return commonType; if (TokenTraits::isBitOp(_operator) || TokenTraits::isBooleanOp(_operator) || _operator == Token::Exp) return nullptr; - return commonType; + + return TypeResult::err("Arithmetic operators on fixed point types are not yet supported."); } IntegerType const* FixedPointType::asIntegerType() const