Skip to content

[ty] Add error context for TypedDict assignments#24790

Merged
sharkdp merged 1 commit intomainfrom
david/typeddict-context
Apr 23, 2026
Merged

[ty] Add error context for TypedDict assignments#24790
sharkdp merged 1 commit intomainfrom
david/typeddict-context

Conversation

@sharkdp
Copy link
Copy Markdown
Contributor

@sharkdp sharkdp commented Apr 22, 2026

Summary

Add error context for TypedDict to TypedDict assignments

image

Test Plan

Adapted and new Markdown tests.

@sharkdp sharkdp added ty Multi-file analysis & type inference diagnostics Related to reporting of diagnostics. labels Apr 22, 2026
```toml
[environment]
python-version = "3.12"
python-version = "3.13"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For typing.ReadOnly

@sharkdp sharkdp force-pushed the david/typeddict-context branch from 11d34f4 to 2348b2a Compare April 22, 2026 14:56
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 22, 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 22, 2026

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 22, 2026

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@sharkdp sharkdp marked this pull request as ready for review April 22, 2026 15:06
@astral-sh-bot astral-sh-bot Bot requested a review from charliermarsh April 22, 2026 15:06
| |
| Declared type
|
info: field "name" on TypedDict `Person` has type `str` which is not assignable to type `bytes` expected by TypedDict `Other`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

or maybe

Suggested change
info: field "name" on TypedDict `Person` has type `str` which is not assignable to type `bytes` expected by TypedDict `Other`
info: Incompatible types for the `name` field
info: └── `str` is not assignable to `bytes`

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no, that would contradict the general structure. If str and bytes were more complex types, we would show a subtree, but we don't do that for basic types.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm, okay. it just about fits onto a single line on a terminal screen if I have the terminal full-screen:

image

but not at all if I'm split-screening (but then, I'm sure that also applies for other diagnostic messages we show -- including, in this case, the summary message:

image

@carljm carljm removed their request for review April 22, 2026 16:58
@sharkdp sharkdp merged commit e7cc762 into main Apr 23, 2026
56 checks passed
@sharkdp sharkdp deleted the david/typeddict-context branch April 23, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diagnostics Related to reporting of diagnostics. ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants