-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-1-normal
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.
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-1-normal