KotlinIsland / KotlinIsland/basedmypy
ban assigning function generic to instance variable declaration
Open
bug
- Dominant language
- Python
- Stars
- 202
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
```py
class C: # Note: Generic[T] missing
def bad_idea(self, x: T) -> None:
self.x = x # should be error
def nope(self, x: T) -> None:
self.x = x # E: Incompatible types in assignment (expression has type "T", variable has type "T")
```
Contributor guide
Research direction
Use the Python reproduction in the issue as the starting case and locate the type-checking path for assignments to instance variables involving function-scoped type variables. Compare the two shown methods and existing assignment diagnostics; done means the invalid assignment is rejected with the expected incompatible-types error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100