From 7cadc6f8614c2a991f4c1a2b407e8163da85b726 Mon Sep 17 00:00:00 2001 From: Leo-Besancon Date: Fri, 18 Oct 2024 14:50:59 +0200 Subject: [PATCH] Fix double Enf in cas of Bindary::Eq --- ir/src/passes/translate.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ir/src/passes/translate.rs b/ir/src/passes/translate.rs index 7f9d1593..c110272e 100644 --- a/ir/src/passes/translate.rs +++ b/ir/src/passes/translate.rs @@ -250,9 +250,14 @@ impl<'a> MirBuilder<'a> { // Enforce statements can be translated to Enf operations in the MIR on scalar expressions ast::Statement::Enforce(scalar_expr) => { let scalar_expr = self.insert_scalar_expr(scalar_expr)?; - self.insert_op(Operation::Enf(scalar_expr)); - - Ok(()) + match self.mir.constraint_graph().node(&scalar_expr).op() { + Operation::Enf(_node_index) => Ok(()), + _ => { + self.insert_op(Operation::Enf(scalar_expr)); + Ok(()) + } + } + } ast::Statement::EnforceIf(_, _) => unreachable!(), // This variant was only available after AST's inlining, we should handle EnforceAll instead ast::Statement::EnforceAll(_list_comprehension) => {