From 97948d8c38ec79cf911b82d5ba3d0527814225c5 Mon Sep 17 00:00:00 2001 From: sofia Date: Mon, 28 Jul 2025 12:18:42 +0300 Subject: [PATCH] Help typechecker a little bit --- examples/or_bitwise.reid | 6 +++--- reid/src/mir/typecheck/typecheck.rs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/or_bitwise.reid b/examples/or_bitwise.reid index 731892b..e7b7487 100644 --- a/examples/or_bitwise.reid +++ b/examples/or_bitwise.reid @@ -2,9 +2,9 @@ fn main() -> bool { - let bwand = (0xff & 0xf0) >> 4; - let bwor = (0x0f | 0x00) << 4; - let bwxor = (0xf0 | 0x0f); + let bwand = (0xffu32 & 0xf0) >> 4; + let bwor = (0x0fu32 | 0x00) << 4; + let bwxor = (0xf0u32 | 0x0f); return (bwxor == 255) && ((bwand == 15) || false) && (bwor == 240); } \ No newline at end of file diff --git a/reid/src/mir/typecheck/typecheck.rs b/reid/src/mir/typecheck/typecheck.rs index 1589cf7..59afd4a 100644 --- a/reid/src/mir/typecheck/typecheck.rs +++ b/reid/src/mir/typecheck/typecheck.rs @@ -431,6 +431,7 @@ impl Expression { params: (lhs_type.clone(), rhs_type.clone()), operator: *op, }); + dbg!(&binops, &expected_return_ty); if let Some(binop) = binops .iter() .filter(|f| f.1.return_ty.narrow_into(&expected_return_ty).is_ok())