[ty] recognize non-fully-static specializations

This commit is contained in:
Carl Meyer
2025-05-12 16:34:14 -07:00
parent 41fa082414
commit f68dbfdef1
6 changed files with 41 additions and 19 deletions

View File

@@ -130,3 +130,13 @@ static_assert(is_fully_static(TypeOf[static]))
static_assert(not is_fully_static(CallableTypeOf[gradual]))
static_assert(is_fully_static(CallableTypeOf[static]))
```
## Generics
```py
from typing import Any
from ty_extensions import static_assert, is_fully_static
static_assert(is_fully_static(list[int]))
static_assert(not is_fully_static(list[Any]))
```

View File

@@ -112,7 +112,7 @@ from typing_extensions import _NoDefaultType
static_assert(is_subtype_of(sys.version_info.__class__, AlwaysTruthy))
static_assert(is_subtype_of(types.EllipsisType, AlwaysTruthy))
static_assert(is_subtype_of(_NoDefaultType, AlwaysTruthy))
static_assert(is_subtype_of(slice, AlwaysTruthy))
static_assert(is_subtype_of(slice[int, int, int], AlwaysTruthy))
static_assert(is_subtype_of(types.FunctionType, AlwaysTruthy))
static_assert(is_subtype_of(types.MethodType, AlwaysTruthy))
static_assert(is_subtype_of(typing.TypeVar, AlwaysTruthy))