mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:35:58 +00:00
[red-knot] Avoid panics for ipython magic commands (#14326)
## Summary Avoids panics when encountering Jupyter notebooks with [IPython magic commands](https://ipython.readthedocs.io/en/stable/interactive/magics.html). ## Test Plan Added Jupyter notebook to corpus.
This commit is contained in:
parent
5e64863895
commit
77e8da7497
2 changed files with 5 additions and 1 deletions
|
@ -2164,7 +2164,10 @@ impl<'db> TypeInferenceBuilder<'db> {
|
||||||
ast::Expr::Yield(yield_expression) => self.infer_yield_expression(yield_expression),
|
ast::Expr::Yield(yield_expression) => self.infer_yield_expression(yield_expression),
|
||||||
ast::Expr::YieldFrom(yield_from) => self.infer_yield_from_expression(yield_from),
|
ast::Expr::YieldFrom(yield_from) => self.infer_yield_from_expression(yield_from),
|
||||||
ast::Expr::Await(await_expression) => self.infer_await_expression(await_expression),
|
ast::Expr::Await(await_expression) => self.infer_await_expression(await_expression),
|
||||||
ast::Expr::IpyEscapeCommand(_) => todo!("Implement Ipy escape command support"),
|
ast::Expr::IpyEscapeCommand(_) => {
|
||||||
|
// TODO Implement Ipy escape command support
|
||||||
|
Type::Todo
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.store_expression_type(expression, ty);
|
self.store_expression_type(expression, ty);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../ruff_notebook/resources/test/fixtures/jupyter/unused_variable.ipynb
|
Loading…
Add table
Add a link
Reference in a new issue