-
Notifications
You must be signed in to change notification settings - Fork 282
Closed
Labels
Description
Describe the Bug
pyrefly 0.50.1 says that an overloaded function is incompatible with a Callable that takes a union of the overload argument types and returns (a union of) the overload return types, resulting in bad-assignment or bad-argument-type errors being reported depending on context.
Minimum reproducible example:
from typing import *
@overload
def foo(x: int) -> str: ...
@overload
def foo(x: str) -> str: ...
def foo(x: int | str) -> str:
return str(x)
bar: Callable[[int | str], str] = foo
# `Overload[
# (x: int) -> str
# (x: str) -> str
# ]` is not assignable to `(int | str) -> str` [bad-assignment]Sandbox Link
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable