Closed
Description
Mypy complains about the following program because of deferred type checking:
from typing import Union
def f(a: Union[int, str]) -> None:
x
a = x
a + 1 # Error
x = 1 + 1
If x = 1 + 1
is before the function definition there is no error.
This was originally reported by @ecprice: #1748 (comment). There's additional discussion in the linked PR.