Disallow the exponent to be a signed integer literal

This commit is contained in:
Harikrishnan Mulackal
2020-08-27 12:08:45 +02:00
parent fdc4142b2c
commit 6f22899153
3 changed files with 5 additions and 0 deletions
+2
View File
@@ -712,6 +712,8 @@ TypeResult IntegerType::binaryOperatorResult(Token _operator, Type const* _other
return TypeResult::err("Exponent is fractional.");
if (!rationalNumberType->integerType())
return TypeResult::err("Exponent too large.");
if (rationalNumberType->isNegative())
return TypeResult::err("Exponentiation power is not allowed to be a negative integer literal.");
}
return this;
}