Skip to content

[ty] Reduce diagnostic range for invalid-metaclass#24145

Merged
charliermarsh merged 1 commit intomainfrom
charlie/inv-meta
Mar 23, 2026
Merged

[ty] Reduce diagnostic range for invalid-metaclass#24145
charliermarsh merged 1 commit intomainfrom
charlie/inv-meta

Conversation

@charliermarsh
Copy link
Member

Summary

Closes astral-sh/ty#3116.

@astral-sh-bot astral-sh-bot bot added the ty Multi-file analysis & type inference label Mar 23, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 23, 2026

Typing conformance results

The percentage of diagnostics emitted that were expected errors held steady at 85.38%. The percentage of expected errors that received a diagnostic held steady at 78.70%. The number of fully passing files held steady at 64/132.

Summary

How are test cases classified?

Each test case represents one expected error annotation or a group of annotations sharing a tag. Counts are per test case, not per diagnostic — multiple diagnostics on the same line count as one. Required annotations (E) are true positives when ty flags the expected location and false negatives when it does not. Optional annotations (E?) are true positives when flagged but true negatives (not false negatives) when not. Tagged annotations (E[tag]) require ty to flag exactly one of the tagged lines; tagged multi-annotations (E[tag+]) allow any number up to the tag count. Flagging unexpected locations counts as a false positive.

Metric Old New Diff Outcome
True Positives 835 835 +0
False Positives 143 143 +0
False Negatives 226 226 +0
Total Diagnostics 1055 1055 +0
Precision 85.38% 85.38% +0.00%
Recall 78.70% 78.70% +0.00%
Passing Files 64/132 64/132 +0

True positives changed (1)

1 diagnostic
Test case Diff

generics_basic.py:208

-error[invalid-metaclass] Generic metaclasses are not supported
+error[invalid-metaclass] Generic metaclasses are not supported

@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 23, 2026

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 23, 2026

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@AlexWaygood AlexWaygood changed the title [ty] Reduce diagnostic for range invalid-metaclass [ty] Reduce diagnostic range for invalid-metaclass Mar 23, 2026
@charliermarsh charliermarsh marked this pull request as ready for review March 23, 2026 19:24
Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

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

Nice

@charliermarsh charliermarsh enabled auto-merge (squash) March 23, 2026 23:48
@charliermarsh charliermarsh merged commit 83221a1 into main Mar 23, 2026
48 checks passed
@charliermarsh charliermarsh deleted the charlie/inv-meta branch March 23, 2026 23:53
carljm added a commit that referenced this pull request Mar 25, 2026
* main: (36 commits)
  [ty] Reduce diagnostic range for `invalid-metaclass` (#24145)
  [ty] Simplify TypeVar assignability/subtyping logic (#24138)
  [ty] Prevent tainted loop bindings in cycle normalization (#24143)
  [ty] Add precisely-typed overloads for `TypedDict` update (#24101)
  [ty] Fix folding ranges of comments separated by statements (#24132)
  Bump ecosystem-analyzer pin (#24136)
  Bump ecosystem-analyzer pin (#24135)
  Simplify `NewType` handling in `relation.rs` (#24109)
  [ty] Add more tests for `NewType` subtyping (#24115)
  [ty] Add `NewType`s to the property tests (#24113)
  [ty] Prepare test files for unreachable code change (#24133)
  `analyze graph`: resolve string imports that reference attributes, not just modules (#24058)
  Update Artifact GitHub Actions dependencies (#24116)
  Update taiki-e/install-action action to v2.68.33 (#24130)
  Update taiki-e/install-action action to v2.68.32 (#24123)
  Update Rust crate serde_with to v3.18.0 (#24126)
  Update Swatinem/rust-cache action to v2.9.1 (#24127)
  Update Rust crate quick-junit to 0.6.0 (#24125)
  Update Rust crate clap to v4.6.0 (#24124)
  Update Rust crate tracing-subscriber to v0.3.23 (#24122)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

invalid-metaclass diagnostic range is far too broad

3 participants