Union
is incorrectly constructed when callable()
is used, resulting in a false positive
#9778
Labels
Union
is incorrectly constructed when callable()
is used, resulting in a false positive
#9778
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
The following code fails type checking:
mypy reports
foo.py:9: error: Incompatible return value type (got "Union[T, object]", expected "T")
Your Environment
master
The oddest thing is that this will pass if I replace
callable
with a wrapper, e.g.reveal_type(check)
is almost identical toreveal_type(callable)
:This might be related to other false positives around Union + TypeVar (e.g. #6898) but I am unsure.
The text was updated successfully, but these errors were encountered: