@@ -348,7 +348,7 @@ Its subtyping follows the general rule for subtyping of gradual types.
348348from typing import Any, Never
349349from ty_extensions import static_assert, is_subtype_of
350350
351- static_assert(not is_subtype_of(tuple[Any, ... ], tuple[Any, ... ]))
351+ static_assert(is_subtype_of(tuple[Any, ... ], tuple[Any, ... ]))
352352static_assert(not is_subtype_of(tuple[Any, ... ], tuple[Any]))
353353static_assert(not is_subtype_of(tuple[Any, ... ], tuple[Any, Any]))
354354static_assert(not is_subtype_of(tuple[Any, ... ], tuple[int , ... ]))
@@ -361,7 +361,7 @@ static_assert(is_subtype_of(tuple[Never, ...], tuple[Any, ...]))
361361Same applies when ` tuple[Any, ...] ` is unpacked into a mixed tuple.
362362
363363``` py
364- static_assert(not is_subtype_of(tuple[int , * tuple[Any, ... ]], tuple[int , * tuple[Any, ... ]]))
364+ static_assert(is_subtype_of(tuple[int , * tuple[Any, ... ]], tuple[int , * tuple[Any, ... ]]))
365365static_assert(not is_subtype_of(tuple[int , * tuple[Any, ... ]], tuple[Any, ... ]))
366366static_assert(not is_subtype_of(tuple[int , * tuple[Any, ... ]], tuple[Any]))
367367static_assert(not is_subtype_of(tuple[int , * tuple[Any, ... ]], tuple[Any, Any]))
@@ -370,7 +370,7 @@ static_assert(not is_subtype_of(tuple[int, *tuple[Any, ...]], tuple[int, ...]))
370370static_assert(not is_subtype_of(tuple[int , * tuple[Any, ... ]], tuple[int ]))
371371static_assert(not is_subtype_of(tuple[int , * tuple[Any, ... ]], tuple[int , int ]))
372372
373- static_assert(not is_subtype_of(tuple[* tuple[Any, ... ], int ], tuple[* tuple[Any, ... ], int ]))
373+ static_assert(is_subtype_of(tuple[* tuple[Any, ... ], int ], tuple[* tuple[Any, ... ], int ]))
374374static_assert(not is_subtype_of(tuple[* tuple[Any, ... ], int ], tuple[Any, ... ]))
375375static_assert(not is_subtype_of(tuple[* tuple[Any, ... ], int ], tuple[Any]))
376376static_assert(not is_subtype_of(tuple[* tuple[Any, ... ], int ], tuple[Any, Any]))
@@ -379,7 +379,7 @@ static_assert(not is_subtype_of(tuple[*tuple[Any, ...], int], tuple[int, ...]))
379379static_assert(not is_subtype_of(tuple[* tuple[Any, ... ], int ], tuple[int ]))
380380static_assert(not is_subtype_of(tuple[* tuple[Any, ... ], int ], tuple[int , int ]))
381381
382- static_assert(not is_subtype_of(tuple[int , * tuple[Any, ... ], int ], tuple[int , * tuple[Any, ... ], int ]))
382+ static_assert(is_subtype_of(tuple[int , * tuple[Any, ... ], int ], tuple[int , * tuple[Any, ... ], int ]))
383383static_assert(not is_subtype_of(tuple[int , * tuple[Any, ... ], int ], tuple[Any, ... ]))
384384static_assert(not is_subtype_of(tuple[int , * tuple[Any, ... ], int ], tuple[Any]))
385385static_assert(not is_subtype_of(tuple[int , * tuple[Any, ... ], int ], tuple[Any, Any]))
@@ -647,10 +647,10 @@ from typing_extensions import TypeGuard, TypeIs
647647# TODO : TypeGuard
648648# static_assert(is_subtype_of(TypeGuard[int], TypeGuard[int]))
649649# static_assert(is_subtype_of(TypeGuard[bool], TypeGuard[int]))
650+ # static_assert(not is_subtype_of(TypeGuard[int], TypeGuard[bool]))
650651static_assert(is_subtype_of(TypeIs[int ], TypeIs[int ]))
651652static_assert(is_subtype_of(TypeIs[int ], TypeIs[int ]))
652653
653- static_assert(not is_subtype_of(TypeGuard[int ], TypeGuard[bool ]))
654654static_assert(not is_subtype_of(TypeIs[bool ], TypeIs[int ]))
655655static_assert(not is_subtype_of(TypeIs[int ], TypeIs[bool ]))
656656```
@@ -821,7 +821,7 @@ represented by a materialization of the second type.
821821from ty_extensions import Unknown, is_subtype_of, static_assert, Intersection
822822from typing_extensions import Any
823823
824- static_assert(not is_subtype_of(Any, Any))
824+ static_assert(is_subtype_of(Any, Any))
825825static_assert(not is_subtype_of(Any, int ))
826826static_assert(not is_subtype_of(int , Any))
827827static_assert(is_subtype_of(Any, object ))
@@ -835,7 +835,7 @@ static_assert(not is_subtype_of(tuple[int, int], tuple[int, Any]))
835835The same for ` Unknown ` :
836836
837837``` py
838- static_assert(not is_subtype_of(Unknown, Unknown))
838+ static_assert(is_subtype_of(Unknown, Unknown))
839839static_assert(not is_subtype_of(Unknown, int ))
840840static_assert(not is_subtype_of(int , Unknown))
841841static_assert(is_subtype_of(Unknown, object ))
@@ -870,7 +870,7 @@ static_assert(is_subtype_of(InheritsAny, object))
870870Similar for subclass-of types:
871871
872872``` py
873- static_assert(not is_subtype_of(type[Any], type[Any]))
873+ static_assert(is_subtype_of(type[Any], type[Any]))
874874static_assert(not is_subtype_of(type[object ], type[Any]))
875875static_assert(not is_subtype_of(type[Any], type[Arbitrary]))
876876static_assert(is_subtype_of(type[Any], type[object ]))
0 commit comments