mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
[ty] type[…]
is always assignable to type
(#18121)
## Summary Model that `type[C]` is always assignable to `type`, even if `C` is not fully static. closes https://github.com/astral-sh/ty/issues/312 ## Test Plan * New Markdown tests * Property tests
This commit is contained in:
parent
a5ee1a3bb1
commit
c066bf0127
2 changed files with 15 additions and 0 deletions
|
@ -196,6 +196,12 @@ static_assert(is_assignable_to(type[Any], Meta))
|
|||
static_assert(is_assignable_to(type[Unknown], Meta))
|
||||
static_assert(is_assignable_to(Meta, type[Any]))
|
||||
static_assert(is_assignable_to(Meta, type[Unknown]))
|
||||
|
||||
class AnyMeta(metaclass=Any): ...
|
||||
|
||||
static_assert(is_assignable_to(type[AnyMeta], type))
|
||||
static_assert(is_assignable_to(type[AnyMeta], type[object]))
|
||||
static_assert(is_assignable_to(type[AnyMeta], type[Any]))
|
||||
```
|
||||
|
||||
## Heterogeneous tuple types
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue