-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugmypy got something wrongmypy got something wrongpriority-0-hightopic-strict-optionaltopic-union-types
Description
Without --strict-optional, the second reveal_type produces an incorrect result:
from typing import Any, Union, TypeVar
class C(Any):
pass
T = TypeVar('T')
S = TypeVar('S')
def f(x: T, y: S) -> Union[T, S]:
pass
reveal_type(f(C(), None)) # t.C
reveal_type(f(None, C())) # builtins.None <--- wrong
With --strict-optional, both of them are wrong:
... # as above
reveal_type(f(C(), None)) # builtins.None <--- wrong
reveal_type(f(None, C())) # builtins.None <--- wrong
This seems to cause problems in real-world code together with python/typeshed@6008b9d, so this is high priority.
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongpriority-0-hightopic-strict-optionaltopic-union-types