small changes in the checker
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 15 Dec 2020 01:55:01 +0000 (19:55 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 15 Dec 2020 01:55:01 +0000 (19:55 -0600)
onyx
src/onyxchecker.c

diff --git a/onyx b/onyx
index 8f9659c1a627dae859409d54e42933c12c68ebdf..75994f769a929bf46e1190e1ff2799fd902fc8db 100755 (executable)
Binary files a/onyx and b/onyx differ
index 01c95e42c2af37a0681b83c9a862a41bbfd69a32..2a65f6510b798d2d96224c22ae3fa511bad2e028 100644 (file)
@@ -726,17 +726,17 @@ b32 check_binaryop(AstBinaryOp** pbinop, b32 assignment_is_ok) {
     }
 
     if (type_is_pointer(binop->right->type)) {
-        onyx_report_error(binop->token->pos, "Right side of binary operator is a pointer.");
+        onyx_report_error(binop->token->pos, "Right side of a binary operator cannot be a pointer.");
         return 1;
     }
 
     if (binop->left->type->kind == Type_Kind_Basic
-        && binop->left->type->Basic.kind == Basic_Kind_Rawptr
-        && !binop_is_compare(binop)) {
+        && binop->left->type->Basic.kind == Basic_Kind_Rawptr) {
         onyx_report_error(binop->token->pos, "Cannot operate on a 'rawptr'. Cast it to a another pointer type first.");
         return 1;
     }
-
+    
+    // CLEANUP: Remove this check since it is kind of redundant with the code below.
     b32 lptr = type_is_pointer(binop->left->type);
     if (lptr && (binop->operation != Binary_Op_Add && binop->operation != Binary_Op_Minus)) {
         onyx_report_error(binop->token->pos, "This operator is not supported for these operands.");