mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:43 +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;
|
} = with_statement;
|
||||||
|
|
||||||
for item in items {
|
for item in items {
|
||||||
match item.optional_vars.as_deref() {
|
let target = item.optional_vars.as_deref();
|
||||||
Some(ast::Expr::Name(name)) => {
|
if let Some(ast::Expr::Name(name)) = target {
|
||||||
self.infer_definition(name);
|
self.infer_definition(name);
|
||||||
}
|
} else {
|
||||||
_ => {
|
// TODO infer definitions in unpacking assignment
|
||||||
// TODO infer definitions in unpacking assignment
|
self.infer_expression(&item.context_expr);
|
||||||
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