Skip to content

assert_type fails to fail for NoReturn #16319

Open
@ghost

Description

Bug Report

In a case that mypy deems impossible (i.e. type narrowed to NoReturn), it's currently impossible to cause assert_type to fail.

Similarly, reveal_type has no effect in the case of NoReturn.

To Reproduce

https://mypy-play.net/?mypy=latest&python=3.11&gist=10400960688da44ab22b58df6c297f50

Expected Behavior

Three assert_type failures.

Actual Behavior

Only one assert_type failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions