-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Rename unreachable_lines to skipped_lines #15483
Conversation
7b3c35a
to
62df7bb
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG, but there are small comments.
mypy/errors.py
Outdated
@@ -223,8 +223,8 @@ class Errors: | |||
# (path -> line -> error-codes) | |||
ignored_lines: dict[str, dict[int, list[str]]] | |||
|
|||
# Lines that are statically unreachable (e.g. due to platform/version check). | |||
unreachable_lines: dict[str, set[int]] | |||
# Lines that were skipped during semantic analysis (would not be type-checked). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the examples of a reason to skip: e.g. due to platform/version check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, always-true: 5b6dc5f
mypy/nodes.py
Outdated
@@ -314,8 +314,8 @@ class MypyFile(SymbolNode): | |||
# If the value is empty, ignore all errors; otherwise, the list contains all | |||
# error codes to ignore. | |||
ignored_lines: dict[int, list[str]] | |||
# Lines that are statically unreachable (e.g. due to platform/version check). | |||
unreachable_lines: set[int] | |||
# Lines that were skipped during semantic analysis (would not be type-checked). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the examples of a reason to skip: e.g. due to platform/version check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, always-true: 5b6dc5f
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
In #15164 we've made it so that
# type: ignore
s in lines skipped in semantic analysis would not be flagged as unused.In #15164 they were called "unreachable" lines but unreachability during type-checking can result in the "Statement is unreachable" error, while these statements are pruned before type-checking, so for clarity we'll use the term "skipped".