mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
[red-knot] visit with-item vars even if not a Name (#13409)
This fixes the last panic on checking pandas. (Match statement became an `if let` because clippy decided it wanted that once I added the additional line in the else case?) --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
f110d80279
commit
260c2ecd15
2 changed files with 9 additions and 8 deletions
|
@ -926,14 +926,13 @@ impl<'db> TypeInferenceBuilder<'db> {
|
|||
} = with_statement;
|
||||
|
||||
for item in items {
|
||||
match item.optional_vars.as_deref() {
|
||||
Some(ast::Expr::Name(name)) => {
|
||||
self.infer_definition(name);
|
||||
}
|
||||
_ => {
|
||||
// TODO infer definitions in unpacking assignment
|
||||
self.infer_expression(&item.context_expr);
|
||||
}
|
||||
let target = item.optional_vars.as_deref();
|
||||
if let Some(ast::Expr::Name(name)) = target {
|
||||
self.infer_definition(name);
|
||||
} else {
|
||||
// TODO infer definitions in unpacking assignment
|
||||
self.infer_expression(&item.context_expr);
|
||||
self.infer_optional_expression(target);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
with foo() as self.bar:
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue