## Summary Part of #15382, this PR adds support for disjointness between two callable types. They are never disjoint because there exists a callable type that's a subtype of all other callable types: ```py (*args: object, **kwargs: object) -> Never ``` The `Never` is a subtype of every fully static type thus a callable type that has the return type of `Never` means that it is a subtype of every return type. ## Test Plan Add test cases related to mixed parameter kinds, gradual form (`...`) and `Never` type.
424 B
424 B
Tuple
Never
If a tuple type contains a Never element, then it is eagerly simplified to Never which means
that a tuple type containing Never is disjoint from any other tuple type.
from typing_extensions import Never
def _(x: tuple[Never], y: tuple[int, Never], z: tuple[Never, int]):
reveal_type(x) # revealed: Never
reveal_type(y) # revealed: Never
reveal_type(z) # revealed: Never