Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overloaded function as a subtype of function with union types args/return #495

Open
JukkaL opened this issue Nov 8, 2014 · 0 comments
Open

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Nov 8, 2014

This code should probably be valid:

from typing import Callable, Union, overload

def f(fn: Callable[[Union[int, str]], Union[int, str]]) -> None: pass

@overload
def g(x: int) -> int: ...
@overload
def g(x: str) -> str: ...
def g(x): ...

f(g)   # Currently error

I.e., an overloaded function should be a subtype of a suitable function with union type arguments and return value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants