-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
from typing import Union, NoReturn
def func() -> Union[str, NoReturn]:
return 'test'
func().lower()
Here, Unoin[str, NoReturn]
should effectively be treated as the same as str
. But mypy doesn't seem to do that.
$ mypy code.py
code.py:6: error: Item "NoReturn" of "Union[str, NoReturn]" has no attribute "lower"
Found 1 error in 1 file (checked 1 source file)
More information in this discussion page: python/typing#994 (comment)
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong
Projects
Milestone
Relationships
Development
Select code repository
Activity
gschaffner commentedon Oct 14, 2022
This appears to be fixed as of Mypy 0.940.
hauntsaninja commentedon Oct 14, 2022
Thanks, this was fixed in #11996