Skip to content

Warn about unconstrained typevars #3254

@JelleZijlstra

Description

@JelleZijlstra

I think code like this should produce an error:

def f(x: AnyStr) -> None: ...

because there's nothing to constrain the type variable. There is a good amount of code like this in typeshed.

I'm not sure how easy this would be to implement. Maybe it should be behind a flag at first; I imagine this proposed change may lead to a lot of new errors, but it's a good way to educate people about what typevars are for.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions