Skip to content

Commit 5ab3053

Browse files
committed
XXX fwomp
1 parent b4e6939 commit 5ab3053

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

crates/ty_python_semantic/resources/mdtest/generics/pep695/variables.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ python-version = "3.13"
77

88
[PEP 695] and Python 3.12 introduced new, more ergonomic syntax for type variables.
99

10+
## fwomp
11+
12+
```py
13+
from ty_extensions import is_assignable_to, is_subtype_of, static_assert
14+
from ty_extensions import Intersection
15+
from typing import Any
16+
17+
class Super: ...
18+
class Base(Super): ...
19+
class Sub(Base): ...
20+
class Unrelated: ...
21+
22+
def constrained_by_gradual[T: (Base, Any)](t: T) -> None:
23+
static_assert(not is_subtype_of(T, Sub))
24+
```
25+
1026
## Type variables
1127

1228
### Defining PEP 695 type variables

crates/ty_python_semantic/resources/mdtest/type_compendium/never.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
`Never` represents the empty set of values.
44

5+
## fwomp
6+
7+
```py
8+
from ty_extensions import static_assert, is_subtype_of
9+
from typing_extensions import Never, TypeVar
10+
11+
T = TypeVar("T", bound=Never)
12+
13+
def _(t: T):
14+
static_assert(is_subtype_of(T, Never))
15+
```
16+
517
## `Never` is a subtype of every type
618

719
The `Never` type is the bottom type of Python's type system. It is a subtype of every type, but no

0 commit comments

Comments
 (0)