Open
Description
I would expect the type of either
to be narrowed to Maybe
in the if
block.
from typing import Literal
class Maybe:
def should(self) -> bool:
...
class No:
def should(self) -> Literal[False]:
...
no: No
if no.should():
reveal_type(no) # error: unreachable
either: Maybe | No
if either.should():
reveal_type(either) # Maybe | No
Metadata
Metadata
Assignees
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity