mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-28 10:50:26 +00:00
## Summary
Add type narrowing inside comprehensions:
```py
def _(xs: list[int | None]):
[reveal_type(x) for x in xs if x is not None] # revealed: int
```
closes https://github.com/astral-sh/ty/issues/680
## Test Plan
* New Markdown tests
* Made sure the example from https://github.com/astral-sh/ty/issues/680
now checks without errors
* Made sure that all removed ecosystem diagnostics were actually false
positives
|
||
|---|---|---|
| .. | ||
| boolean.md | ||
| elif_else.md | ||
| eq.md | ||
| in.md | ||
| is.md | ||
| is_not.md | ||
| nested.md | ||
| not.md | ||