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

private methods shouldn't affect variance #698

Open
DetachHead opened this issue Sep 26, 2024 · 0 comments
Open

private methods shouldn't affect variance #698

DetachHead opened this issue Sep 26, 2024 · 0 comments
Labels
type checking / linting issues relating to existing diagnostic rules or proposals for new diagnostic rules

Comments

@DetachHead
Copy link
Owner

Code sample in basedpyright playground

class Foo[T]: # (type parameter) T: T@Foo (contravariant)
    def __foo(self, value: T): ...

since __foo can't be called outside of the class, i'm pretty sure it's safe for the generic to be covariant

@DetachHead DetachHead added the type checking / linting issues relating to existing diagnostic rules or proposals for new diagnostic rules label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type checking / linting issues relating to existing diagnostic rules or proposals for new diagnostic rules
Projects
None yet
Development

No branches or pull requests

1 participant