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

[red-knot] special-case returning NotImplemented #16661

Open
carljm opened this issue Mar 12, 2025 · 0 comments
Open

[red-knot] special-case returning NotImplemented #16661

carljm opened this issue Mar 12, 2025 · 0 comments
Labels
red-knot Multi-file analysis & type inference

Comments

@carljm
Copy link
Contributor

carljm commented Mar 12, 2025

NotImplemented should always be returnable, no matter what return type annotation a function has.

Other type checkers seem to handle this by just treating NotImplemented as if it were Any, but I don't think that's right.

We can easily handle this by treating NotImplemented as a KnownInstance and special-casing it in return type checking.

(Arguably this special case should only apply to certain methods, but that seems more complex and perhaps not worth it.)

@carljm carljm added the red-knot Multi-file analysis & type inference label Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

No branches or pull requests

1 participant