You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix reachability inference with 'isinstance(Any, Any)' (#7048)
While experimenting with some reachability inference logic, I discovered
the following program does not seem to behave as expected:
```python
from typing import Any
from foo import A # type: ignore
x: Any
if isinstance(x, A):
reveal_type(x)
else:
reveal_type(x)
```
Both branches really ought to be reachable: since both `x` and `A` are
of type `Any`, we really can't say whether or not any particular branch
will run.
However, mypy currently instead assumes that only the first branch is
reachable and does not type-check the second branch. So in this example,
only the first `reveal_type(...)` outputs a note.
This pull request fixes this bug.
0 commit comments