Commit 3a542a8
authored
[ty] Handle cycles when finding implicit attributes (#19833)
The [minimal
reproduction](https://gist.github.com/dcreager/fc53c59b30d7ce71d478dcb2c1c56444)
of astral-sh/ty#948 is an example of a class
with implicit attributes whose types end up depending on themselves. Our
existing cycle detection for `infer_expression_types` is usually enough
to handle this situation correctly, but when there are very many of
these implicit attributes, we get a combinatorial explosion of running
time and memory usage.
Adding a separate cycle handler for `ClassLiteral::implicit_attribute`
lets us catch and recover from this situation earlier.
Closes astral-sh/ty#9481 parent 4be6fc0 commit 3a542a8
1 file changed
+41
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
92 | 112 | | |
93 | 113 | | |
94 | 114 | | |
| |||
2359 | 2379 | | |
2360 | 2380 | | |
2361 | 2381 | | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
2362 | 2401 | | |
2363 | 2402 | | |
2364 | 2403 | | |
| |||
2392 | 2431 | | |
2393 | 2432 | | |
2394 | 2433 | | |
2395 | | - | |
| 2434 | + | |
2396 | 2435 | | |
2397 | 2436 | | |
2398 | 2437 | | |
| |||
2450 | 2489 | | |
2451 | 2490 | | |
2452 | 2491 | | |
2453 | | - | |
| 2492 | + | |
2454 | 2493 | | |
2455 | 2494 | | |
2456 | 2495 | | |
| |||
0 commit comments