From 0efde77d2c7f92c2d43ab1972de70870f76aaeb7 Mon Sep 17 00:00:00 2001 From: nub31 Date: Sun, 28 Sep 2025 22:53:09 +0200 Subject: [PATCH] ... --- compiler/NubLang/TypeChecking/TypeChecker.cs | 6 +++--- example/src/main.nub | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/compiler/NubLang/TypeChecking/TypeChecker.cs b/compiler/NubLang/TypeChecking/TypeChecker.cs index 1be3894..ceecac8 100644 --- a/compiler/NubLang/TypeChecking/TypeChecker.cs +++ b/compiler/NubLang/TypeChecking/TypeChecker.cs @@ -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()); } diff --git a/example/src/main.nub b/example/src/main.nub index 7db1572..2f470c1 100644 --- a/example/src/main.nub +++ b/example/src/main.nub @@ -28,6 +28,16 @@ extern "main" func main(args: []cstring): i64 } raylib::EndDrawing() + if x + width > raylib::GetScreenWidth() + { + direction.x = -direction.x + } + + if y + height > raylib::GetScreenHeight() + { + direction.y = -direction.y + } + x = x + @floatToInt(i32, direction.x) y = y + @floatToInt(i32, direction.y) }