From 30e66be568418709110d911859d027710799542c Mon Sep 17 00:00:00 2001 From: microproofs Date: Thu, 12 Sep 2024 15:02:30 -0400 Subject: [PATCH] Fix soft casting case --- crates/aiken-lang/src/gen_uplc.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/aiken-lang/src/gen_uplc.rs b/crates/aiken-lang/src/gen_uplc.rs index 361f0e76..eb407235 100644 --- a/crates/aiken-lang/src/gen_uplc.rs +++ b/crates/aiken-lang/src/gen_uplc.rs @@ -666,13 +666,14 @@ impl<'a> CodeGenerator<'a> { self.build(final_else, module_build_name, &[]), |acc, branch| { let condition = self.build(&branch.condition, module_build_name, &[]); - let body = self.build(&branch.body, module_build_name, &[]); match &branch.is { Some((pattern, tipo)) => { introduce_pattern(&mut self.interner, pattern); self.interner.intern("acc_var".to_string()); + let body = self.build(&branch.body, module_build_name, &[]); + let acc_var = self.interner.lookup_interned(&"acc_var".to_string()); @@ -703,7 +704,12 @@ impl<'a> CodeGenerator<'a> { tree } - None => AirTree::if_branch(tipo.clone(), condition, body, acc), + None => AirTree::if_branch( + tipo.clone(), + condition, + self.build(&branch.body, module_build_name, &[]), + acc, + ), } }, )