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: https://github.com/python/mypy/pull/1748#issuecomment-255212676. There's additional discussion in the linked PR.
Activity
ilevkivskyi commentedon Sep 3, 2019
This works correctly on master.