Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error for invalid TypeGuard function #4448

Closed
erictraut opened this issue Jan 12, 2023 · 2 comments
Closed

Add error for invalid TypeGuard function #4448

erictraut opened this issue Jan 12, 2023 · 2 comments
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request

Comments

@erictraut
Copy link
Collaborator

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.

@erictraut erictraut added the enhancement request New feature or request label Jan 12, 2023
erictraut pushed a commit that referenced this issue Jan 13, 2023
…es not have at least one input parameter. This addresses #4448.
@erictraut
Copy link
Collaborator Author

This will be included in the next release.

@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Jan 13, 2023
@erictraut
Copy link
Collaborator Author

This is included in pyright 1.1.289, which I just published. It will also be included in a future release of pylance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant