KotlinIsland / KotlinIsland/basedmypy

generic bound `TypeVar` broke with `Callable`

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

Description

```py
from typing import Callable, TypeVar

R = TypeVar("R")
StrFn = TypeVar("StrFn", bound=Callable[[str], R])

def deco(fn: StrFn) -> StrFn:
return fn

@deco
def foo(value: str): # error, incorrect
...

@deco
def bar(value: str, value2: str = ""): # error, incorrect
...

@deco
def baz(value: str, value2: str): # error, correct
...
```

Contributor guide

Open the contributing guide

Research direction

Use the provided Python snippet as the reproducer and run it through basedmypy to compare the diagnostics for foo, bar, and baz. Done means the incorrect errors on foo and bar are resolved while baz retains its expected error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.