Skip to content

Passing an unpacked tuple of types as type arguments to the type parameters [T, *Ts] gets error #2363

Closed

Description

@hyperkai

Describe the Bug

*Memo:

  • pyrefly check test.py
  • pyrefly 0.46.1
  • Python 3.14.0

Passing an unpacked tuple of types as type arguments to the type parameters [T, *Ts] gets the error as shown below:

*Memo:

  • mypy and ty don't get error.
from typing import Unpack

class Cls[T, *Ts]: ...

v1: Cls[*tuple[int, str, int, str]]        # Error
v2: Cls[Unpack[tuple[int, str, int, str]]] # Error

ERROR Unpacked argument cannot be used for type parameter T

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Activity

  1. yangdanny97 commented on Feb 8, 2026

    @yangdanny97
    Collaborator

    Sandbox

    The relevant part of the typing conformance test is here:

    TA9 = tuple[*Ts, T1]
    TA10 = TA9[*tuple[int, ...]]  # OK
    
    TA11 = tuple[T, *Ts1]
    TA12 = TA11[*Ts2]  # E
    

    To me this seems like we should allow unpacking a regular tuple type in this context but not another TypeVarTuple.

    When using concrete or unpacked type forms we need to make sure there are enough types, so TA9[*tuple[()]] would still error, as would TA9[*tuple[*Ts2]]

  2. added theissue type on Feb 8, 2026
  3. added
    help wantedLarger than "good first issue", but still well-defined and ready for someone to pick up
    on Feb 8, 2026
  4. asukaminato0721 commented on Feb 9, 2026

    @asukaminato0721
    Collaborator

    claim

  5. migeed-z commented on Feb 23, 2026

    @migeed-z
    Contributor

    Note: PR #2364 which is currently landing will not address the conformance issue. Do not close it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

conformancehelp wantedLarger than "good first issue", but still well-defined and ready for someone to pick uptypechecking

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions