Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
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:
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
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
This pull request fixes this bug.