Repository navigation
Switch error code used to report vars defined in different branch - #14176
Merged
ilinum merged 2 commits intoNov 25, 2022
Merged
Conversation
ilevkivskyi
reviewed
Nov 23, 2022
This comment has been minimized.
This comment has been minimized.
ilevkivskyi
approved these changes
Nov 25, 2022
Contributor
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
JukkaL
pushed a commit
that referenced
this pull request
Dec 19, 2022
A similar case was addressed in #14176 but I missed the part where it doesn't need to be defined in a different branch. This makes the fix more complete.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We previously used
use-before-defcode here but this commit switched it to usepartially-defined. This particular check generates a lot of false positives, in particular around loops of the form:While in an ideal world mypy has no false positives, it's not feasible for us to handle this correctly in the short-term. Moving this to partially-defined error code makes the
use-before-defhave a much lower false positive rate, which is a plus. Unfortunately,partially-definedwill always have a higher false positive rate. This means that if we enable it by default, lots of people will disable this check. We want to avoid the same thing happening to use-before-def check.See this PR for further discussion.