KotlinIsland / KotlinIsland/basedmypy

inference fails with generic intersection of `Callable`

Open
#798 0 comments 0 reactions 0 assignees View on GitHub
topic-intersection
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

```py
from __future__ import annotations

from typing import Callable

AnyCallable = Callable[..., object] # type: ignore[no-any-explicit]

def wrap[TCallable: AnyCallable, **P, R](fn: TCallable & Callable[P, R]): ...

def f() -> int: ...

wrap(f) # Argument 1 to "wrap" has incompatible type "def () -> int"; expected "Never & (*Never, **Never) -> Never"
```

Contributor guide

Open the contributing guide

Research direction

The issue provides a self-contained Python reproducer but names no source files or tests. Run the snippet through basedmypy first, then trace callable generic and intersection inference. Done means the shown wrap(f) call is accepted without the reported incompatible-type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.