KotlinIsland / KotlinIsland/basedmypy
generic bounds don't work with syntax generics
Open
- Dominant language
- Python
- Stars
- 202
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
```py
from typing import TypeVar, Collection
T = TypeVar('T')
L = TypeVar('L', bound=Collection[T])
def foo(l: L) -> T:
return l[0]
reveal_type(foo([1])) # int
def bar[T2, L2: Collection[T2]](l: L2) -> T:
return l[0]
reveal_type(bar([1])) # Never
```
Contributor guide
Research direction
Start by running the two generic examples in the issue and compare their reveal_type results. Trace how traditional TypeVar bounds and syntax generic bounds are handled, then verify that bar([1]) infers int rather than Never and that the existing foo behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100