Skip to content

Concrete type not assignable to gradual type when TypeVarTuple is involved #4609

Description

@Wizzerinus

Describe the Bug

In the following code example:

from typing import Any, Callable

class K[*Ts]:
    func: Callable[[Any, *Ts], None]

def g[*Ts](x: int, *xs: *Ts):
    K[*Ts]().func(x, *xs)

The call to func gets rejected because "Unpacked argument tuple[int, *Ts] is not assignable to varargs type tuple[Any, *Ts]". But it should be assignable, because Any is a gradual type. Even if it wasn't, tuples are also covariant.

Sandbox Link

https://pyrefly.org/sandbox/?project=v2.I7fIRGQn72itkOJYaMCA0q4VXFF0NFgPSB5YRAKTATgXglJHOliTRoUVMA6BhZlWBTCrAkVgyQ9ipoamHsg8jQqwAmCcYga5skIAREAB6npgYQOMq_RSYJEGjAO9mDxlYGmWqpBRUlJQbKWvD9OeX5Sun5qnn5KfXKyPokNfAZS6EssSM8E-QDVOIR-cRIqBxlIS1-qQqFbHF9PqoIgGqsAbeQA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions