pyright icon indicating copy to clipboard operation
pyright copied to clipboard

Overload evaluation does not conform to typing spec

Open erictraut opened this issue 1 year ago • 0 comments

A recent addition to the typing spec conformance test uncovered a case that pyright is handling incorrectly.

This is found in the overloads_evaluation.py test in this PR.

@overload
def example5(obj: list[int]) -> list[int]: ...


@overload
def example5(obj: list[str]) -> list[str]: ...


def example5(obj: Any) -> list[Any]:
    return []


def check_example5(b: list[Any]) -> None:
    assert_type(example5(b), Any)

erictraut avatar Apr 01 '25 02:04 erictraut