From 2151fe4484f9256d5cb8330831318d4a1dc1e318 Mon Sep 17 00:00:00 2001 From: rvcas Date: Wed, 15 Feb 2023 23:55:36 -0500 Subject: [PATCH] fix(infer): if branch bodies need to be checked in a new scope --- crates/aiken-lang/src/tipo/expr.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/aiken-lang/src/tipo/expr.rs b/crates/aiken-lang/src/tipo/expr.rs index 637aaac5..ac5686e4 100644 --- a/crates/aiken-lang/src/tipo/expr.rs +++ b/crates/aiken-lang/src/tipo/expr.rs @@ -1556,7 +1556,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> { false, )?; - let body = self.infer(first.body.clone())?; + let body = self.in_new_scope(|body_typer| body_typer.infer(first.body.clone()))?; let tipo = body.tipo(); @@ -1576,7 +1576,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> { false, )?; - let body = self.infer(branch.body.clone())?; + let body = self.in_new_scope(|body_typer| body_typer.infer(branch.body.clone()))?; self.unify( tipo.clone(), @@ -1592,7 +1592,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> { }); } - let typed_final_else = self.infer(final_else)?; + let typed_final_else = self.in_new_scope(|body_typer| body_typer.infer(final_else))?; self.unify( tipo.clone(),