Skip to content

Incomplete equivalence of *args, **kwargs signature to ... signature #902

@github-actions

Description

@github-actions

All four reveal-types at the end of this example should reveal Literal[True]:

from typing import Callable, reveal_type
from ty_extensions import Intersection, Unknown, CallableTypeOf, Not, is_assignable_to

def f(*n1, **n2) -> None: ...

type A = Not[Callable[..., None]]
type B = Not[CallableTypeOf[f]]

def g(a: A, b: B):
    reveal_type(a)
    reveal_type(b)

reveal_type(is_assignable_to(A, A | B))  # revealed: Literal[True]
reveal_type(is_assignable_to(A, B | A))  # revealed: Literal[False]
reveal_type(is_assignable_to(B, A | B))  # revealed: Literal[False]
reveal_type(is_assignable_to(B, B | A))  # revealed: Literal[True]

Originally revealed by property tests in this run: https://github.com/astral-sh/ty/actions/runs/16550887703

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedContributions especially welcometype propertiessubtyping, assignability, equivalence, and more

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions