[ty] Fix attribute lookup on type[T] where T has a union bound#22116
Merged
charliermarsh merged 2 commits intocharlie/unionsfrom Dec 21, 2025
Merged
[ty] Fix attribute lookup on type[T] where T has a union bound#22116charliermarsh merged 2 commits intocharlie/unionsfrom
type[T] where T has a union bound#22116charliermarsh merged 2 commits intocharlie/unionsfrom
Conversation
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
3bccb24 to
f62be39
Compare
4549d81 to
a9e126a
Compare
AlexWaygood
reviewed
Dec 20, 2025
Member
There was a problem hiding this comment.
Haven't looked too closely yet but it surprises me a bit that we'd have to map over the bounds/constraints like this... would appreciate it if @ibraheemdev could take a look, since he originally implemented type[T] where T is a type variable
Member
|
Okay that looks a lot more like what I'd expect! 😃 but I'd still love it if @ibraheemdev could take a look |
Member
Author
|
Let’s go! |
Member
Author
|
(The test case here does depend on #22115 being merged though.) |
92459ec to
f68a261
Compare
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.
Summary
For
type[T]whereT: Replace | Multiply, we now do the following:try_from_instance(Replace | Multiply)becomestype[Replace] | type[Multiply]to_meta_type(type[Replace] | type[Multiply])becomestype[type] | type[type]which becomestype[type]See: #22115 (comment)