@@ -1147,10 +1147,10 @@ static_assert(
11471147 )
11481148)
11491149
1150- static_assert(not is_equivalent_to(GenericProto[str ], GenericProto[int ]))
1151- static_assert(not is_equivalent_to(GenericProto[str ], LegacyGenericProto[int ]))
1152- static_assert(not is_equivalent_to(GenericProto, GenericProto[int ]))
1153- static_assert(not is_equivalent_to(LegacyGenericProto, LegacyGenericProto[int ]))
1150+ static_assert(not is_equivalent_to(GenericProto[str ], GenericProto[int ])) # error: [static-assert-error]
1151+ static_assert(not is_equivalent_to(GenericProto[str ], LegacyGenericProto[int ])) # error: [static-assert-error]
1152+ static_assert(not is_equivalent_to(GenericProto, GenericProto[int ])) # error: [static-assert-error]
1153+ static_assert(not is_equivalent_to(LegacyGenericProto, LegacyGenericProto[int ])) # error: [static-assert-error]
11541154```
11551155
11561156## Intersections of protocols
@@ -1543,8 +1543,7 @@ from ty_extensions import is_equivalent_to
15431543class HasMutableXAttr (Protocol ):
15441544 x: int
15451545
1546- # TODO : should pass
1547- static_assert(is_equivalent_to(HasMutableXAttr, HasMutableXProperty)) # error: [static-assert-error]
1546+ static_assert(is_equivalent_to(HasMutableXAttr, HasMutableXProperty))
15481547
15491548static_assert(is_subtype_of(HasMutableXAttr, HasXProperty))
15501549static_assert(is_assignable_to(HasMutableXAttr, HasXProperty))
@@ -1810,9 +1809,7 @@ class P4(Protocol):
18101809 def z (self , value : int ) -> None : ...
18111810
18121811static_assert(is_equivalent_to(P1, P2))
1813-
1814- # TODO : should pass
1815- static_assert(is_equivalent_to(P3, P4)) # error: [static-assert-error]
1812+ static_assert(is_equivalent_to(P3, P4))
18161813```
18171814
18181815As with protocols that only have non-method members, this also holds true when they appear in
@@ -1823,9 +1820,7 @@ class A: ...
18231820class B : ...
18241821
18251822static_assert(is_equivalent_to(A | B | P1, P2 | B | A))
1826-
1827- # TODO : should pass
1828- static_assert(is_equivalent_to(A | B | P3, P4 | B | A)) # error: [static-assert-error]
1823+ static_assert(is_equivalent_to(A | B | P3, P4 | B | A))
18291824```
18301825
18311826## Narrowing of protocols
@@ -2106,8 +2101,6 @@ class Bar(Protocol):
21062101 @ property
21072102 def x (self ) -> " Bar" : ...
21082103
2109- # TODO : this should pass
2110- # error: [static-assert-error]
21112104static_assert(is_equivalent_to(Foo, Bar))
21122105
21132106T = TypeVar(" T" , bound = " TypeVarRecursive" )
0 commit comments