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

None comparison overlap is wrong #676

Open
KotlinIsland opened this issue Apr 25, 2024 · 0 comments
Open

None comparison overlap is wrong #676

KotlinIsland opened this issue Apr 25, 2024 · 0 comments
Labels

Comments

@KotlinIsland
Copy link
Owner

KotlinIsland commented Apr 25, 2024

a: int | None
b: str | None
a == b  # Non-overlapping equality check (left operand type: "int | None", right operand type: "str | None")  [comparison-overlap]

but it's still useful :trollface: :
Although this error message is flat out wrong, I do see the inadvertent value here: NoneType is a singleton inhabitant type, so it is more likely accidental, rather than intentionally checking that both values are None. If I wanted that I would write:

a is None and b is None

perhaps:

a == b  # warning: the operands only overlap with "None", consider writing "a is None and b is None"  [none-overlap]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant