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

No support for "callable" decorators #1837

Closed
gvanrossum opened this issue Jul 9, 2016 · 1 comment
Closed

No support for "callable" decorators #1837

gvanrossum opened this issue Jul 9, 2016 · 1 comment

Comments

@gvanrossum
Copy link
Member

This works fine:

F = TypeVar('F', bound=Callable[..., Any])
def outer(f: F) -> F:
    def inner(*args):
        return f(*args)
    return cast(F, inner)

@outer
def foo(a: int) -> str:
    return str(a)

However adding this does not work (it reuses the outer decorator from above):

def superouter() -> Callable[[F], F]:
    return outer

@superouter()  # E: Argument 1 has incompatible type Callable[[str], int]; expected None
def bar(b: str) -> int:
    return int(b)
@rwbarton
Copy link
Contributor

rwbarton commented Jul 9, 2016

This is a duplicate of #1551, though the exact errors seem to have changed a little since then.

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

No branches or pull requests

2 participants