ty
ty copied to clipboard
Fix `Todo` type inferred when subscripting an intersection
from typing import Sequence
class C: ...
def f(x: Sequence[int]):
if isinstance(x, C):
reveal_type(x[0]) # revealed: @Todo
We should infer int there (and, same as our current behaviour, we should not emit a diagnostic).
This was previously attempted in https://github.com/astral-sh/ruff/pull/18846 but then reverted in https://github.com/astral-sh/ruff/pull/18920