Skip to content

__bool__: add NoReturn to flag its use statically - #14

Open
Andrej730 wants to merge 1 commit into
travisjungroth:mainfrom
Andrej730:dunder-bool-noreturn
Open

__bool__: add NoReturn to flag its use statically#14
Andrej730 wants to merge 1 commit into
travisjungroth:mainfrom
Andrej730:dunder-bool-noreturn

Conversation

@Andrej730

Copy link
Copy Markdown

Currently pyright already flags the use of __bool__ for a in the snippet below as an issue
Adding explicit NoReturn return type annotation to allow other type checkers (e.g. mypy with --warn-unreachable) to flag it too.

class A:
    def __bool__(self):
        raise TypeError


def test(a: A) -> None:
    if a:
        print("42")
    print("32")

@Andrej730

Copy link
Copy Markdown
Author

@travisjungroth Hi! Can you please take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant