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

(🐞) Callables are joined into builtins.function #17017

Closed
KotlinIsland opened this issue Mar 12, 2024 · 2 comments
Closed

(🐞) Callables are joined into builtins.function #17017

KotlinIsland opened this issue Mar 12, 2024 · 2 comments
Labels
bug mypy got something wrong topic-join-v-union Using join vs. using unions

Comments

@KotlinIsland
Copy link
Contributor

from typing import Callable

class C:
    def __init__(self, i: int=1): ...

c1: Callable[[], object] = C
c2: Callable[[int], object] = C
reveal_type(c1 if bool() else c2)  # Revealed type is "builtins.function"

It should be joined into... something else, either object or Callable[..., object] or something.

@KotlinIsland KotlinIsland added the bug mypy got something wrong label Mar 12, 2024
@JelleZijlstra JelleZijlstra added the topic-join-v-union Using join vs. using unions label Mar 12, 2024
@hauntsaninja
Copy link
Collaborator

Duplicate of #10740

@hauntsaninja hauntsaninja marked this as a duplicate of #10740 Mar 13, 2024
@hauntsaninja hauntsaninja closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
@KotlinIsland
Copy link
Contributor Author

KotlinIsland commented Mar 13, 2024

@hauntsaninja That issue is regarding joining () -> int and (int =) -> int into () -> int.

This issue is regarding how completely incompatible Callables are joined into function. Which sometimes does make sense (i.e. when you are using functions), but makes no sense when you are using some other type of Callable, like in my example where I am using types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-join-v-union Using join vs. using unions
Projects
None yet
Development

No branches or pull requests

3 participants