[ty] Add cycle handling to lazy_default (#20967)
This commit is contained in:
@@ -313,6 +313,23 @@ static_assert(is_subtype_of(Bottom[JsonDict], Bottom[JsonDict]))
|
||||
static_assert(is_subtype_of(Bottom[JsonDict], Top[JsonDict]))
|
||||
```
|
||||
|
||||
### Cyclic defaults
|
||||
|
||||
```py
|
||||
from typing_extensions import Protocol, TypeVar
|
||||
|
||||
T = TypeVar("T", default="C", covariant=True)
|
||||
|
||||
class P(Protocol[T]):
|
||||
pass
|
||||
|
||||
class C(P[T]):
|
||||
pass
|
||||
|
||||
reveal_type(C[int]()) # revealed: C[int]
|
||||
reveal_type(C()) # revealed: C[Divergent]
|
||||
```
|
||||
|
||||
### Union inside generic
|
||||
|
||||
#### With old-style union
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
spark # too many iterations (in `exported_names` query), `should not be able to access instance member `spark` of type variable IndexOpsLike@astype in inferable position`
|
||||
steam.py # dependency graph cycle when querying TypeVarInstance < 'db >::lazy_default_(Id(2e007)), set cycle_fn/cycle_initial to fixpoint iterate.
|
||||
steam.py # too many iterations
|
||||
|
||||
Reference in New Issue
Block a user