Add augmented assignment inference for -= operator (#13981)

## Summary

See: https://github.com/astral-sh/ruff/issues/12699
This commit is contained in:
Charlie Marsh 2024-10-29 22:14:27 -04:00 committed by GitHub
parent 39cf46ecd6
commit c6b82151dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 179 additions and 65 deletions

View file

@ -955,6 +955,12 @@ where
};
let symbol = self.add_symbol(id.clone());
if is_use {
self.mark_symbol_used(symbol);
let use_id = self.current_ast_ids().record_use(expr);
self.current_use_def_map_mut().record_use(symbol, use_id);
}
if is_definition {
match self.current_assignment().copied() {
Some(CurrentAssignment::Assign {
@ -1018,12 +1024,6 @@ where
}
}
if is_use {
self.mark_symbol_used(symbol);
let use_id = self.current_ast_ids().record_use(expr);
self.current_use_def_map_mut().record_use(symbol, use_id);
}
walk_expr(self, expr);
}
ast::Expr::Named(node) => {