[ty] Fix panic due to simplifying Divergent types out of intersections types (#21253)

This commit is contained in:
Shunsuke Shibayama 2025-11-04 00:41:11 +09:00 committed by GitHub
parent 39f105bc4a
commit b5305b5f32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 60 additions and 23 deletions

View file

@ -0,0 +1,10 @@
# Regression test for https://github.com/astral-sh/ruff/pull/20962
# error message:
# `infer_definition_types(Id(1804)): execute: too many cycle iterations`
for name_1 in {
{{0: name_4 for unique_name_0 in unique_name_1}: 0 for unique_name_2 in unique_name_3 if name_4}: 0
for unique_name_4 in name_1
for name_4 in name_1
}:
pass

View file

@ -35,16 +35,3 @@ else:
async def name_5():
pass
```
## Too many cycle iterations in `infer_definition_types`
<!-- expect-panic: too many cycle iterations -->
```py
for name_1 in {
{{0: name_4 for unique_name_0 in unique_name_1}: 0 for unique_name_2 in unique_name_3 if name_4}: 0
for unique_name_4 in name_1
for name_4 in name_1
}:
pass
```