ruff
ad417282 - [ty] Avoid temporarily storing invalid multi-inference attempts (#22103)

Commit
20 days ago
[ty] Avoid temporarily storing invalid multi-inference attempts (#22103) ## Summary I missed this in https://github.com/astral-sh/ruff/pull/22062. This avoids exponential runtime in the following snippet: ```py class X1: ... class X2: ... class X3: ... class X4: ... class X5: ... class X6: ... ... def f( x: list[X1 | None] | list[X2 | None] | list[X3 | None] | list[X4 | None] | list[X5 | None] | list[X6 | None] ... ): ... def g[T](x: T) -> list[T]: return [x] def id[T](x: T) -> T: return x f(id(id(id(id(g(X64())))))) ``` Eventually I want to refactor our multi-inference infrastructure (which is currently very brittle) to handle this implicitly, but this is a temporary performance fix until that happens.
Author
Parents
Loading