...
This commit is contained in:
@@ -427,7 +427,7 @@ public sealed class TypeChecker
|
||||
case BinaryOperatorSyntax.LogicalOr:
|
||||
{
|
||||
var left = CheckExpression(expression.Left);
|
||||
if (left.Type is not NubIntType or NubFloatType)
|
||||
if (left.Type is not NubIntType and not NubFloatType)
|
||||
{
|
||||
throw new TypeCheckerException(Diagnostic.Error("Logical operators must must be used with int or float types").At(expression.Left).Build());
|
||||
}
|
||||
@@ -453,7 +453,7 @@ public sealed class TypeChecker
|
||||
case BinaryOperatorSyntax.Modulo:
|
||||
{
|
||||
var left = CheckExpression(expression.Left);
|
||||
if (left.Type is not NubIntType or NubFloatType)
|
||||
if (left.Type is not NubIntType and not NubFloatType)
|
||||
{
|
||||
throw new TypeCheckerException(Diagnostic.Error("Math operators must be used with int or float types").At(expression.Left).Build());
|
||||
}
|
||||
@@ -492,7 +492,7 @@ public sealed class TypeChecker
|
||||
case UnaryOperatorSyntax.Negate:
|
||||
{
|
||||
var operand = CheckExpression(expression.Operand);
|
||||
if (operand.Type is not NubIntType { Signed: false } or NubFloatType)
|
||||
if (operand.Type is not NubIntType { Signed: false } and not NubFloatType)
|
||||
{
|
||||
throw new TypeCheckerException(Diagnostic.Error("Negation operator must be used with signed integer or float types").At(expression).Build());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user