From 73ac2a27d08dd15698c0b283177ea90035d84d8f Mon Sep 17 00:00:00 2001 From: guipublic Date: Mon, 18 Sep 2023 13:02:32 +0000 Subject: [PATCH] check for literal overflows in expressions --- compiler/noirc_frontend/src/hir/type_check/stmt.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/noirc_frontend/src/hir/type_check/stmt.rs b/compiler/noirc_frontend/src/hir/type_check/stmt.rs index 0407f79049f..5db23c3f4f2 100644 --- a/compiler/noirc_frontend/src/hir/type_check/stmt.rs +++ b/compiler/noirc_frontend/src/hir/type_check/stmt.rs @@ -297,6 +297,10 @@ impl<'interner> TypeChecker<'interner> { HirExpression::Prefix(_) => self .errors .push(TypeCheckError::InvalidUnaryOp { kind: annotated_type.to_string(), span }), + HirExpression::Infix(expr) => { + self.lint_overflowing_uint(&expr.lhs, annotated_type); + self.lint_overflowing_uint(&expr.rhs, annotated_type); + } _ => {} } }