Conversation
Aliases and tuples weren't working for a simple reason, which is that unpacking a types.GenericAlias with a `*` doesn't produce an `Unpack`, but produces a `types.GenericAlias` with `__unpacked__` set. Since we didn't consider that, we would simply lose track of it. Fix that by stripping __unpacked__, evaling the inner type, and adding an Unpack. Built-in operators didn't work because `_GenericAlias` produces an `_UnpackGenericAlias` when iterated, and `_UnpackGenericAlias` raises an exception when it is passed to a variadic generic if it's body is either sort of generic alias but isn't a tuple. Fix that by a bunch of annoying overloading of what aliases our operators produce. And then, with the annoying parts done, we just need to actually implement the unpacking of tuple types.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dnwpark
approved these changes
Jan 31, 2026
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.
Aliases and tuples weren't working for a simple reason, which is that
unpacking a types.GenericAlias with a
*doesn't produce anUnpack,but produces a
types.GenericAliaswith__unpacked__set. Since wedidn't consider that, we would simply lose track of it. Fix that by
stripping unpacked, evaling the inner type, and adding an Unpack.
Built-in operators didn't work because
_GenericAliasproduces an_UnpackGenericAliaswhen iterated, and_UnpackGenericAliasraisesan exception when it is passed to a variadic generic if it's body is
either sort of generic alias but isn't a tuple. Fix that by a bunch
of annoying overloading of what aliases our operators produce.
And then, with the annoying parts done, we just need to actually
implement the unpacking of tuple types.