Merge pull request #8903 from ethereum/exponentiation-bug

Fix exponentiation bug
This commit is contained in:
chriseth
2020-05-13 15:49:23 +02:00
committed by GitHub
4 changed files with 25 additions and 0 deletions
+7
View File
@@ -613,6 +613,13 @@ TypeResult IntegerType::binaryOperatorResult(Token _operator, Type const* _other
}
else if (dynamic_cast<FixedPointType const*>(_other))
return nullptr;
else if (auto rationalNumberType = dynamic_cast<RationalNumberType const*>(_other))
{
if (rationalNumberType->isFractional())
return TypeResult::err("Exponent is fractional.");
if (!rationalNumberType->integerType())
return TypeResult::err("Exponent too large.");
}
return this;
}