-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix --strict-equality
for iteratively visited code
#19635
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
The primer results are a little mysterious. I could simplify to: for y in [1.0]:
if y is not None or y != "None": # E: Non-overlapping equality check (left operand type: "float", right operand type: "Literal['None']")
... This obvious error is only reported with my change, but I do not know why current master misses it and therefore have no idea what in this PR contributes to detecting it. For whatever reason this happens, I will add a corresponding test case. |
This comment has been minimized.
This comment has been minimized.
Ah, I got it. It is because optuna enables I could invest some time so that for y in [1.0]:
if y is not None or y != "None":
... and y = 1.0
if y is not None or y != "None":
... would be handled identically again (no |
This comment has been minimized.
This comment has been minimized.
…p errors (return -> break)
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
I revisited the problem and added two lines of code that reset the old behaviour for the discussed problem and make some sense to me. The problem was that "nearer" error watchers could not filter non-overlap reports anymore. Now, the collection mechanism of Lines 5982 to 5999 in 5a78607
|
Fixes #19328
The logic is very similar to what we did to report different revealed types that were discovered in multiple iteration steps in one line. I think this fix is the last one needed before I can implement #19256.