fix(infer): if branch bodies need to be checked in a new scope

This commit is contained in:
rvcas 2023-02-15 23:55:36 -05:00 committed by Lucas
parent c4a588f3dd
commit 2151fe4484
1 changed files with 3 additions and 3 deletions

View File

@ -1556,7 +1556,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
false, 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(); let tipo = body.tipo();
@ -1576,7 +1576,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
false, false,
)?; )?;
let body = self.infer(branch.body.clone())?; let body = self.in_new_scope(|body_typer| body_typer.infer(branch.body.clone()))?;
self.unify( self.unify(
tipo.clone(), 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( self.unify(
tipo.clone(), tipo.clone(),