Skip to content

Generate a warning/error on assigning values of type NoReturn #4179

Open
@Wilfred

Description

@Wilfred
import sys
from typing import List
from mypy_extensions import NoReturn

def never_returns() -> NoReturn:
    sys.exit(1)

def foo() -> None:
    x = never_returns()

It would be nice if mypy warned in this situation.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions