KotlinIsland / KotlinIsland/basedmypy

Support unbound generics

Open
#30 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.