File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
crates/ty_python_semantic/resources/mdtest Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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
719The ` Never ` type is the bottom type of Python's type system. It is a subtype of every type, but no
You can’t perform that action at this time.
0 commit comments