[red-knot] Move tuple containing Never tests (#17137)

Refer
https://github.com/astral-sh/ruff/pull/17094#discussion_r2023682840
This commit is contained in:
Dhruv Manilawala 2025-04-02 08:16:18 +05:30 committed by GitHub
parent eb3e176309
commit f63024843c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 15 deletions

View file

@ -1,15 +0,0 @@
# 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.
```py
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
```

View file

@ -19,6 +19,11 @@ static_assert(is_equivalent_to(Never, tuple[int, Never]))
static_assert(is_equivalent_to(Never, tuple[int, Never, str]))
static_assert(is_equivalent_to(Never, tuple[int, tuple[str, Never]]))
static_assert(is_equivalent_to(Never, tuple[tuple[str, Never], int]))
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
```
The empty `tuple` is *not* equivalent to `Never`!