mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:43 +00:00
![]() ## Summary
This PR adds type narrowing in `and` and `or` expressions, for example:
```py
class A: ...
x: A | None = A() if bool_instance() else None
isinstance(x, A) or reveal_type(x) # revealed: None
```
## Test Plan
New mdtests 😍
|
||
---|---|---|
.. | ||
boolean.md | ||
conditionals_elif_else.md | ||
conditionals_is.md | ||
conditionals_is_not.md | ||
conditionals_nested.md | ||
conditionals_not.md | ||
conditionals_not_eq.md | ||
isinstance.md | ||
match.md |