Disallow unary plus at the parsing stage

This commit is contained in:
Kamil Śliwak
2023-04-18 16:47:00 +02:00
parent ee1b50d345
commit 8a14680851
9 changed files with 27 additions and 20 deletions
+3 -2
View File
@@ -819,16 +819,17 @@ BoolResult FixedPointType::isExplicitlyConvertibleTo(Type const& _convertTo) con
TypeResult FixedPointType::unaryOperatorResult(Token _operator) const
{
solAssert(_operator != Token::Add);
switch (_operator)
{
case Token::Delete:
// "delete" is ok for all fixed types
return TypeResult{TypeProvider::emptyTuple()};
case Token::Add:
case Token::Sub:
case Token::Inc:
case Token::Dec:
// for fixed, we allow +, -, ++ and --
// for fixed, we allow -, ++ and --
return this;
default:
return nullptr;