fix double inference of standalone expressions (#14107)

This commit is contained in:
Micha Reiser 2024-11-05 15:50:31 +01:00 committed by GitHub
parent 05f97bae73
commit 05687285fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 67 additions and 23 deletions

View file

@ -1088,10 +1088,13 @@ where
// AST inspection, so we can't simplify here, need to record test expression for
// later checking)
self.visit_expr(test);
let constraint = self.record_expression_constraint(test);
let pre_if = self.flow_snapshot();
self.visit_expr(body);
let post_body = self.flow_snapshot();
self.flow_restore(pre_if);
self.record_negated_constraint(constraint);
self.visit_expr(orelse);
self.flow_merge(post_body);
}