Skip to content

[ty] Fix anchor point for override diagnostics#25621

Merged
lerebear merged 2 commits into
mainfrom
lerebear/push-qrzznusqqvus
Jun 4, 2026
Merged

[ty] Fix anchor point for override diagnostics#25621
lerebear merged 2 commits into
mainfrom
lerebear/push-qrzznusqqvus

Conversation

@lerebear

@lerebear lerebear commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

This corrects the range to which we anchor diagnostics for invalid-explicit-override and missing-override-decorator errors. Both are now anchored to a definition in the file currently being checked (which is where the override occurs).

Previously, we handled this incorrectly for property instances in particular by assuming that the getter was always the accessor to use as the diagnostic target (even if we were actually overriding a different accessor, such as the setter). Now, we correctly consider all property accessors and choose the override in the file being checked as the diagnostic target.

Closes astral-sh/ty#3654.

Test Plan

Please see included tests.

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Jun 4, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 92.13%. The percentage of expected errors that received a diagnostic held steady at 87.18%. The number of fully passing files held steady at 92/134.

@astral-sh-bot

astral-sh-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot

astral-sh-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@lerebear lerebear force-pushed the lerebear/push-qrzznusqqvus branch 5 times, most recently from 762f5e0 to d1b0bc2 Compare June 4, 2026 17:35
@lerebear lerebear changed the title [ty] Fix missing-override-decorator diagnostics for inherited property accessors. [ty] Fix anchor point for override diagnostics Jun 4, 2026
@lerebear lerebear force-pushed the lerebear/push-qrzznusqqvus branch 2 times, most recently from e85d9f0 to e47cde1 Compare June 4, 2026 18:06
@lerebear lerebear marked this pull request as ready for review June 4, 2026 18:23
@astral-sh-bot astral-sh-bot Bot requested a review from charliermarsh June 4, 2026 18:23
@lerebear lerebear force-pushed the lerebear/push-qrzznusqqvus branch from e47cde1 to 9f6e8d0 Compare June 4, 2026 18:25
@AlexWaygood AlexWaygood added the bug Something isn't working label Jun 4, 2026
Comment thread crates/ty_python_semantic/src/types/overrides.rs Outdated
Comment thread crates/ty_python_semantic/src/types/overrides.rs Outdated
Comment thread crates/ty_python_semantic/src/types/overrides.rs Outdated
Comment thread crates/ty_python_semantic/src/types/overrides.rs
Comment thread crates/ty_python_semantic/src/types/overrides.rs
Diagnostics for `invalid-explicit-override` and `missing-override-decorator`
should both be anchored to a definition in the file currently being checked
(which is where the override occurs). Previously, we handled this incorrectly
for property instances by assuming that the getter was always the accessor to
use as the diagnostic target (even if we were actually overriding a different
accessor, such as the setter). Now, we correctly consider all property accessors
and choose the override in the file being checked as the diagnostic target.
@lerebear lerebear force-pushed the lerebear/push-qrzznusqqvus branch from 9f6e8d0 to 94885f7 Compare June 4, 2026 20:18
@lerebear lerebear merged commit 30ed317 into main Jun 4, 2026
59 checks passed
@lerebear lerebear deleted the lerebear/push-qrzznusqqvus branch June 4, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

panic: AST indices should never change within the same revision with missing-override-decorator

4 participants