Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ty] Handle aliased dict fallbacks in TypedDict unions#25241

Merged
charliermarsh merged 2 commits into
mainfrom
charlie/ty-3488-aliased-dict-fallback
May 19, 2026
Merged

[ty] Handle aliased dict fallbacks in TypedDict unions#25241
charliermarsh merged 2 commits into
mainfrom
charlie/ty-3488-aliased-dict-fallback

Conversation

@charliermarsh

@charliermarsh charliermarsh commented May 19, 2026

Copy link
Copy Markdown
Member

Summary

When a TypedDict union includes a dict-compatible fallback behind a type alias, we need to resolve it, as in:

type IntFloatDict = dict[int, float]
type TypedDictOrDictAlias = TD | IntFloatDict

value: TypedDictOrDictAlias = {1: 5.2}

There are some other similar bugs that I noticed while working on this, which I'll fix in separate PRs.

Closes astral-sh/ty#3488.

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

astral-sh-bot Bot commented May 19, 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 89.36%. The percentage of expected errors that received a diagnostic held steady at 85.49%. The number of fully passing files held steady at 88/134.

@astral-sh-bot

astral-sh-bot Bot commented May 19, 2026

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot

astral-sh-bot Bot commented May 19, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@charliermarsh charliermarsh added the bug Something isn't working label May 19, 2026
@charliermarsh charliermarsh marked this pull request as ready for review May 19, 2026 15:34
@astral-sh-bot astral-sh-bot Bot requested a review from dhruvmanila May 19, 2026 15:34
Comment thread crates/ty_python_semantic/src/types/infer/builder.rs Outdated
@charliermarsh charliermarsh merged commit c130dce into main May 19, 2026
58 checks passed
@charliermarsh charliermarsh deleted the charlie/ty-3488-aliased-dict-fallback branch May 19, 2026 18:58
thejchap pushed a commit to thejchap/ruff that referenced this pull request May 23, 2026
## Summary

When a `TypedDict` union includes a `dict`-compatible fallback behind a
type alias, we need to resolve it, as in:

```python
type IntFloatDict = dict[int, float]
type TypedDictOrDictAlias = TD | IntFloatDict

value: TypedDictOrDictAlias = {1: 5.2}
```

There are some other similar bugs that I noticed while working on this,
which I'll fix in separate PRs.

Closes astral-sh/ty#3488.
anishgirianish pushed a commit to anishgirianish/ruff that referenced this pull request May 28, 2026
## Summary

When a `TypedDict` union includes a `dict`-compatible fallback behind a
type alias, we need to resolve it, as in:

```python
type IntFloatDict = dict[int, float]
type TypedDictOrDictAlias = TD | IntFloatDict

value: TypedDictOrDictAlias = {1: 5.2}
```

There are some other similar bugs that I noticed while working on this,
which I'll fix in separate PRs.

Closes astral-sh/ty#3488.
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.

Incorrect assignability with union involving TypedDict

2 participants