From ab99aa4744187aea40839b2811c047e2365dc607 Mon Sep 17 00:00:00 2001 From: sirasistant Date: Fri, 16 Feb 2024 09:33:06 +0000 Subject: [PATCH] fix: enforce matching types of binary ops in SSA --- compiler/noirc_evaluator/src/ssa/function_builder/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/noirc_evaluator/src/ssa/function_builder/mod.rs b/compiler/noirc_evaluator/src/ssa/function_builder/mod.rs index 9e17595a033..fe71b876879 100644 --- a/compiler/noirc_evaluator/src/ssa/function_builder/mod.rs +++ b/compiler/noirc_evaluator/src/ssa/function_builder/mod.rs @@ -216,6 +216,11 @@ impl FunctionBuilder { operator: BinaryOp, rhs: ValueId, ) -> ValueId { + assert_eq!( + self.type_of_value(lhs), + self.type_of_value(rhs), + "ICE - Binary instruction operands must have the same type" + ); let instruction = Instruction::Binary(Binary { lhs, rhs, operator }); self.insert_instruction(instruction, None).first() }