Skip to content

Unpacking of tuple typed asTypeVarTuple sometimes yeilds type *tuple[object, ...] #792

@cstruct

Description

@cstruct

Describe the Bug

Unpacking a tuple typed as a TypeVarTuple Ts into another tuple should yield tuple[*tuple[Ts]] but sometimes yields tuple[*tuple[object, ...]]. I can only replicate this if the expression is nested in a sufficiently complex expression where the tuple is first used as the argument to a callable and spread into the target tuple later and all of this happens in a loop. Both mypy and pyright accepts the attached test cases.

Sandbox Link

https://pyrefly.org/sandbox/?code=GYJw9gtgBALgngBwJYDsDmUkQWEMoBUAUCQCYCmws5AzjAIwDaBAKjQLoAUAHgFywBXBABtyzNuwA0UOP1QwAlFAC0APigA5MCnK8iUA1ACG-YUjqMYQ0eJrT57dlAC8URu32GjAOiMIE5CiknJwE3NJwCgokRBRUMLQwAEy2XJ4GfIIiYqwckukycigw+Upqmtq6BSZQZhZW2bb2xY4ubh6GUMC4UAD6mChQIEbo5Jz0AAwKep2dPn4BQSFhEVExcdR0AMypnAWZDTa5UgWyAyUFCCDkpEgAxkYJ-ADCRsLCRgBGNpbWORJSKCfMBgYQnMrqLQ6GZeUzmGC-Rq5ZowVqudwFJBUK43e6PMbcaYFOa+fyBYKhcIyNZkSibGAAFl2+34h3+eVORQunRxtweTygr3eXx+bNSgOBoPBKkhlRhBhqdQRYuR5zR7QK3RAfQGQxGaDGkyJs0MWKgvLxCR4xpNs3mZKWlNW0SAA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions