Skip to content

Overload evaluation does not conform to typing spec #10232

@erictraut

Description

@erictraut

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions