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 59d0231 commit 8ca60d5Copy full SHA for 8ca60d5
crates/ty_python_semantic/resources/mdtest/protocols.md
@@ -1729,6 +1729,21 @@ def _(r: Recursive):
1729
reveal_type(r.method(r).callable1(1).direct.t[1][1]) # revealed: Recursive
1730
```
1731
1732
+### Mutually-recursive protocols
1733
+
1734
+```py
1735
+from typing import Protocol
1736
+from ty_extensions import is_equivalent_to, static_assert
1737
1738
+class Foo(Protocol):
1739
+ x: "Bar"
1740
1741
+class Bar(Protocol):
1742
+ x: Foo
1743
1744
+static_assert(is_equivalent_to(Foo, Bar))
1745
+```
1746
1747
### Regression test: narrowing with self-referential protocols
1748
1749
This snippet caused us to panic on an early version of the implementation for protocols.
0 commit comments