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

(🐞) overlapping Callables are incorrectly joined into builtins.function #17479

Open
KotlinIsland opened this issue Jul 3, 2024 · 0 comments
Labels
bug mypy got something wrong good-second-issue

Comments

@KotlinIsland
Copy link
Contributor

KotlinIsland commented Jul 3, 2024

from typing import Callable, _T as T

def join(t1: T, t2: T) -> T: ...
    
def f1() -> None: ...
def f2(i: int = 0) -> None: ...

fn: Callable[[], None] = join(f1, f2)  # Incompatible types in assignment (expression has type "function", variable has type "Callable[[], None]")  [assignment]

f2 is a valid () -> None, this code should not produce any problems

if there is any concern that this is a duplicate of #17478, the difference is that this scenario is:
join( () -> None, (int=) -> None )
and #17479 is
join( () -> None, (int) -> None )

@KotlinIsland KotlinIsland added the bug mypy got something wrong label Jul 3, 2024
hauntsaninja added a commit to hauntsaninja/mypy that referenced this issue Jan 1, 2025
Fixes python#17479 , although as you can see in the test case the logic still
remains far from perfect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong good-second-issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants