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

Rename unreachable_lines to skipped_lines #15483

Merged
merged 2 commits into from
Jun 22, 2023

Conversation

ikonst
Copy link
Contributor

@ikonst ikonst commented Jun 21, 2023

In #15164 we've made it so that # type: ignores 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".

@ikonst ikonst force-pushed the 06-20-rename-reachability branch from 7b3c35a to 62df7bb Compare June 21, 2023 00:18
@github-actions

This comment has been minimized.

Copy link
Member

@ilevkivskyi ilevkivskyi left a 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).
Copy link
Member

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

Copy link
Contributor Author

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).
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, always-true: 5b6dc5f

@github-actions
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@ilevkivskyi ilevkivskyi merged commit aba35af into python:master Jun 22, 2023
19 checks passed
@ikonst ikonst deleted the 06-20-rename-reachability branch June 22, 2023 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants