-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[red-knot] Silence unresolved-attribute in unreachable code
#17305
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
Conversation
|
|
The new error in text_encoding = (
io.text_encoding # type: ignore[unused-ignore, attr-defined]
if sys.version_info > (3, 10)
else _text_encoding
) |
05454c1 to
1a76d8e
Compare
unresolved-attribute diagnostics in unreachable code
unresolved-attribute diagnostics in unreachable codeunresolved-attribute in unreachable code
1a76d8e to
2b51fed
Compare
2b51fed to
d1a5619
Compare
@MichaReiser Is this something specific to this PR, or just a general thought? Anything that should be done about it? |
AlexWaygood
left a comment
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.
Nice, this LGTM
|
I manually checked that nothing changed in pybind11, so I'm ignoring the spurious cycle-panic-diff there. |
I'll create a separate issue for it |
* main: (30 commits) [red-knot] Silence `unresolved-import` in unreachable code (#17336) red_knot_python_semantic: move TODO comment red_knot_python_semantic: rename `lint()` and `report()` ruff_db: use `Annotation::get_message` in more places red_knot_python_semantic: tweak docs on building reporter builders red_knot_python_semantic: remove the "old" secondary message type red_knot_python_semantic: replace one use of "old" secondary diagnostic messages red_knot_python_semantic: update revealed type snapshots ruff_db: tweak how the revealed type diagnostic is rendered red_knot: add explicit test for concise `reveal_type` diagnostic red_knot_python_semantic: remove `InferContext::report_diagnostic` red_knot_python_semantic: add "reporter" API Bump 0.11.5 (#17337) [red-knot] Silence `unresolved-attribute` in unreachable code (#17305) Revert "[red-knot] Type narrowing for assertions (#17149)" (#17335) [red-knot] Type narrowing for assertions (#17149) [red-knot] avoid unnecessary evaluation of visibility constraint on definitely-unbound symbol (#17326) update cargo-dist (#17325) [red-knot] Fix double hovers/inlays in playground (#17334) [red-knot] Track reachability of scopes (#17332) ...
Summary
Basically just repeat the same thing that we did for
unresolved-reference, but now for attribute expressions.We now also handle the case where the unresolved attribute (or the unresolved reference) diagnostic originates from a stringified type annotation.
And I made the evaluation of reachability constraints lazy (will only be evaluated right before we are about to emit a diagnostic).
Test Plan
New Markdown tests for stringified annotations.