Skip to content

Commit

Permalink
fix: enforce matching types of binary ops in SSA
Browse files Browse the repository at this point in the history
  • Loading branch information
sirasistant committed Feb 16, 2024
1 parent f77f702 commit ab99aa4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/noirc_evaluator/src/ssa/function_builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit ab99aa4

Please sign in to comment.