Skip to content

Add error for invalid TypeGuard function #4448

@erictraut

Description

@erictraut

A user-defined TypeGuard function (as defined in PEP 647) is invalid if it doesn't define at least one input parameter. If the function is an instance or class method, it must provide at least one input parameter beyond self or cls. This has been a source of confusion, so an error should perhaps be emitted in this case.

See python/mypy#14425.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions