[ty] Narrow keyword arguments when unpacking dictionary instances#23436
Merged
ibraheemdev merged 2 commits intomainfrom Mar 17, 2026
Merged
[ty] Narrow keyword arguments when unpacking dictionary instances#23436ibraheemdev merged 2 commits intomainfrom
ibraheemdev merged 2 commits intomainfrom
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 85.29%. The percentage of expected errors that received a diagnostic held steady at 78.13%. The number of fully passing files held steady at 64/132. |
Memory usage reportSummary
Significant changesClick to expand detailed breakdownprefect
sphinx
trio
flake8
|
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
0 | 265 | 10 |
unused-type-ignore-comment |
7 | 0 | 0 |
no-matching-overload |
0 | 1 | 0 |
| Total | 7 | 266 | 10 |
3862660 to
1d08375
Compare
|
AlexWaygood
reviewed
Feb 24, 2026
Member
AlexWaygood
left a comment
There was a problem hiding this comment.
This is cool! I'm a bit uncertain about how freely you're intersecting with TypedDicts, though; we need to be pretty careful there. See my inline comments. A synthesized protocol with __getitem__ overloads might be a better fit here.
crates/ty_python_semantic/resources/mdtest/literal/collections/dictionary.md
Outdated
Show resolved
Hide resolved
crates/ty_python_semantic/src/semantic_index/use_def/place_state.rs
Outdated
Show resolved
Hide resolved
crates/ty_python_semantic/resources/mdtest/literal/collections/dictionary.md
Outdated
Show resolved
Hide resolved
carljm
requested changes
Feb 25, 2026
Contributor
carljm
left a comment
There was a problem hiding this comment.
Mostly looks good, but I do think we need to address the intersection-with-TypedDict issue.
crates/ty_python_semantic/resources/mdtest/literal/collections/dictionary.md
Outdated
Show resolved
Hide resolved
crates/ty_python_semantic/resources/mdtest/literal/collections/dictionary.md
Outdated
Show resolved
Hide resolved
crates/ty_python_semantic/resources/mdtest/literal/collections/dictionary.md
Outdated
Show resolved
Hide resolved
1d08375 to
ce8dce8
Compare
carljm
approved these changes
Mar 14, 2026
Contributor
carljm
left a comment
There was a problem hiding this comment.
This is very cool! Found one issue that should be fixed before landing, otherwise looks good!
ce8dce8 to
63cf7be
Compare
63cf7be to
000add9
Compare
carljm
added a commit
that referenced
this pull request
Mar 17, 2026
* main: Pass through ParamSpec relation check for non-overloaded signatures (#23927) [ty] Narrow keyword arguments when unpacking dictionary instances (#23436) [ty] Implement Duboc's TDD optimization for unions of constraint sets (#23881) Remove the repository security policy in favor of the organization one (#24008) Remove the repository code of conduct in favor of the organization one (#24007)
ibraheemdev
added a commit
that referenced
this pull request
Mar 20, 2026
Fixes a bug in #23436 where nested dictionary literals are not tracked, e.g., ```py def f(a: int, b: str): ... x = {"inner": {"a": 1, "b": "a"}} f(**x["inner"]) ``` This is unlikely to have an ecosystem impact, but seems worth doing nonetheless.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends #22882 to use narrowed keys when inferring splatted dictionary expressions.
Resolves astral-sh/ty#1248.