basedpyright icon indicating copy to clipboard operation
basedpyright copied to clipboard

infer overload types

Open KotlinIsland opened this issue 1 year ago • 1 comments

@overload
def f(a: int) -> str: ...

@overload
def f(a: str) -> None: ...

def f(a):
    reveal_type(a)  # int | str
    return 1  # error: expected "str | None"

The types of the implementation signature should be inferred from the overload signatures.

KotlinIsland avatar Apr 12 '24 00:04 KotlinIsland

related: #289

specifically https://github.com/DetachHead/basedpyright/issues/289#issuecomment-2283252114 needs to be addressed for both of these issues imo

DetachHead avatar Aug 12 '24 13:08 DetachHead