[red-knot] Move tuple containing Never tests (#17137)
Refer https://github.com/astral-sh/ruff/pull/17094#discussion_r2023682840
This commit is contained in:
@@ -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
|
||||
```
|
||||
@@ -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`!
|
||||
|
||||
Reference in New Issue
Block a user