ruff
46e214cd - [ty] Project exact-length narrowing through TypeVars (#26852)

Commit
32 days ago
[ty] Project exact-length narrowing through TypeVars (#26852) ## Summary Support exact length narrowing also for typevars. Code like this was previously rejected. ```python T = TypeVar("T", tuple[int, int], tuple[int, int, str]) def f(x: T) -> None: if len(x) == 2: ... elif len(x) == 3: ... else: assert_never(x) # `Never` and `T@f_typevar` are not equivalent types ``` ## Test Plan New mdtests
Author
Parents
Loading