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

false positive errors when calling operator override that returns Never from another function that returns Never #18002

Open
DetachHead opened this issue Oct 21, 2024 · 0 comments
Labels
bug mypy got something wrong

Comments

@DetachHead
Copy link
Contributor

from typing import Never

class Foo:
    def __mul__(self, value: float, /) -> Never:
        raise Exception("multiplication is banned")

    def __rmul__(self, value: float, /) -> Never: # error: Implicit return in function which does not return  [misc]
        self * value
    
    def __rmul_attempt_2__(self, value: float, /) -> Never:
        return self * value # error: Return statement in function which does not return  [misc]

playground

@DetachHead DetachHead added the bug mypy got something wrong label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

1 participant