KotlinIsland / KotlinIsland/basedmypy
Support unbound generics
- Dominant language
- Python
- Stars
- 202
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
**Feature**
We could use `...`, but that might cause trouble with `tuple` and `Callable` so idk.
```py
def foo(l: list[...]):
print(l)
```
https://kotlinlang.org/docs/generics.html#star-projections
```py
T = TypeVar(bound=TUpper)
T_co = TypeVar(bound=TUpper, covariant=True)
T_cont = TypeVar(contravariant=True)
NoReturn_cont = TypeVar(bound=NoReturn, contravariant=True)
```
```py
class Foo(Generic[T_co]): ...
Foo[...] = Foo[T_co]
```
```py
class Foo(Generic[T_cont]): ...
Foo[...] = Foo[NoReturn_cont]
```
```py
class Foo(Generic[T]): ...
Foo[...] = Foo[T_co]
```
Contributor guide
Research direction
No project file, test, or entry point is named. Start by reading the linked Kotlin star-projections reference and tracing how basedmypy currently handles generic subscriptions and TypeVars. Done should include a decided meaning for Foo[...] in the three variance cases and coverage for the list[...] example without breaking tuple or Callable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100