We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 072122b commit b02fd49Copy full SHA for b02fd49
crates/ty_python_semantic/resources/mdtest/protocols.md
@@ -1577,6 +1577,21 @@ def _(r: Recursive):
1577
reveal_type(r.method(r).callable1(1).direct.t[1][1]) # revealed: Recursive
1578
```
1579
1580
+### Mutually-recursive protocols
1581
+
1582
+```py
1583
+from typing import Protocol
1584
+from ty_extensions import is_equivalent_to, static_assert
1585
1586
+class Foo(Protocol):
1587
+ x: "Bar"
1588
1589
+class Bar(Protocol):
1590
+ x: Foo
1591
1592
+static_assert(is_equivalent_to(Foo, Bar))
1593
+```
1594
1595
### Regression test: narrowing with self-referential protocols
1596
1597
This snippet caused us to panic on an early version of the implementation for protocols.
0 commit comments