Open
Description
Hello, i'm doing some refactoring of my app, and wanted to use result
.
Old code uses if some_func(): ...
constructions, and now they're returning Result(), and this should not be treated as error in type checker.
After some testing, i found this:
from typing import NoReturn
class NoIf:
def __bool__(self) -> NoReturn:
raise RuntimeError()
if NoIf():
pass
This results in error in pyright (but not in mypy)
/tmp/test.py:6:4 - error: Invalid conditional operand of type "NoIf"
Method __bool__ for type "NoIf" returns type "NoReturn" rather than "bool" (reportGeneralTypeIssues)
Should i make a PR adding this __bool__
override, if you think this can be useful for everyone?