Skip to content

Improve diagnostics for implicit calls to a possibly unbound unary operator.#24816

Merged
lerebear merged 1 commit intomainfrom
lerebear/push-wksotssrnwqu
Apr 24, 2026
Merged

Improve diagnostics for implicit calls to a possibly unbound unary operator.#24816
lerebear merged 1 commit intomainfrom
lerebear/push-wksotssrnwqu

Conversation

@lerebear
Copy link
Copy Markdown
Contributor

Summary

Building on #24662, and similarly to #24676, this adds more "info" sub-diagnostics to possibly unbound method error messages that occur when a dunder is called implicitly against a union type. The implicit dunder calls covered here are for unary operators (e.g. __pos__).

Closes astral-sh/ty#940.

Test Plan

Please see new/updated mdtests and related snapshots.

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Apr 24, 2026
@lerebear lerebear changed the title Improve diagnostics for implicit calls to a possibly unbound unary operators. Improve diagnostics for implicit calls to a possibly unbound unary operator. Apr 24, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 24, 2026

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 87.94%. The percentage of expected errors that received a diagnostic held steady at 83.36%. The number of fully passing files held steady at 79/133.

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 24, 2026

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 24, 2026

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@lerebear lerebear requested a review from charliermarsh April 24, 2026 18:42
@lerebear lerebear marked this pull request as ready for review April 24, 2026 18:42
Copy link
Copy Markdown
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!

@lerebear lerebear merged commit db83415 into main Apr 24, 2026
56 checks passed
@lerebear lerebear deleted the lerebear/push-wksotssrnwqu branch April 24, 2026 20:38
carljm added a commit to tamird/ruff that referenced this pull request Apr 27, 2026
* main: (248 commits)
  [ty] bump conformance suite commit (astral-sh#24848)
  [ty] Pass unmapped type variables to `SpecializationBuilder::build_with` (astral-sh#24809)
  [ty] Avoid bookkeeping for unannotated functions (astral-sh#24842)
  [ty] Optimize signature checking based on number of arguments (astral-sh#24674)
  [ty] Avoid eagerly inferring legacy generic context (astral-sh#24841)
  [ty] Skip decorator inference for undecorated functions (astral-sh#24839)
  [ty] solve unions against generic protocols (astral-sh#24837)
  [ty] Lazily allocate parameter type builders (astral-sh#24838)
  [ty] Lazily compute call argument fallbacks (astral-sh#24836)
  [ty] Avoid collecting type context callables (astral-sh#24835)
  Bump ecosystem-analyzer to e7576e6 (astral-sh#24834)
  [ty] Support basic narrowing with aliased conditional expressions (astral-sh#24302)
  [ty] Fix project and workspace selection (astral-sh#24824)
  [ty] Fix missing memory usage attributes (astral-sh#24823)
  Fix setting selection for multi folder workspace (astral-sh#24819)
  Improve diagnostics for implicit calls to a possibly unbound unary operator. (astral-sh#24816)
  [ty] Update review pool (astral-sh#24818)
  Bump 0.15.12 (astral-sh#24815)
  [ty] Complete support for more detailed diagnostics on possibly unbound errors from implicit dunder calls against unions. (astral-sh#24676)
  Implement `#ruff:file-ignore` file-level suppressions (astral-sh#23599)
  ...
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.

improve diagnostics for possibly-unbound call-dunder with union

3 participants