[ty] Improve diagnostic for failed assignment to a Callable type. by lerebear · Pull Request #25308 · astral-sh/ruff (original) (raw)

@lerebear

Summary

This improves the diagnostic we show when an assignment to a Callable type fails. That diagnostic now contains additional context that describes the inferred callable type that failed. The result is that the full explanation of the failed assignment is more coherent.

Closes astral-sh/ty#866.

Test Plan

Please see updated tests.

@astral-sh-bot

Typing conformance results

No changes detected ✅

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

@astral-sh-bot

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot

@lerebear lerebear changed the titleImprove diagnostic for failed assignment to a Callable type. [ty] Improve diagnostic for failed assignment to a Callable type.

May 22, 2026

@codspeed-hq

@lerebear lerebear marked this pull request as ready for review

May 28, 2026 22:05

carljm

Choose a reason for hiding this comment

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

Very nice!

It's so cool that we have this infrastructure now and it's so easy to add a contextual message like this; thank you @sharkdp !

@lerebear lerebear deleted the lerebear/push-xqwxruqrnukq branch

May 29, 2026 20:51

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})