Skip to content

Check for overlapping overloads #103

Open
@dhruvmanila

Description

@dhruvmanila

This requires some discussion on what the concrete rules are. There's some context on a discussion about this when the overloads chapter in the typing spec was being updated: python/typing#1839 (comment).

For example (copied from the above discussion):

from typing import Literal, overload

@overload
def is_one(x: Literal[1]) -> True: ...
@overload
def is_one(x: int) -> False: ...

def f(x: int) -> bool:
    return is_one(x)

f(1)  # Presumably True at runtime, but type checker will say False (unless it performs inlining)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions