KotlinIsland / KotlinIsland/basedmypy

type variables should be allowed on `ClassVar`s

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

Description

```py
class A[T]:
t: ClassVar[T]
A[int].t = 1
```
this is obviously an error, but:
```py
class B(A[int]):
pass
B.t = 1
```
this should be allowed

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the two Python snippets from the issue with basedmypy and compare their diagnostics. Trace the handling of generic type variables in ClassVar annotations and inheritance; done means A[int].t is rejected while B.t is accepted.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.