KotlinIsland / KotlinIsland/basedmypy
`list.copy` should return a non-invariant value
Open
feature
- Dominant language
- Python
- Stars
- 202
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
```py
a = [1, 2, 3]
b: list[object] = a.copy() # error: invariance, expected no error
```
```py
class list[T]:
def copy[R >: T]() -> list[R]: ...
```
(which doesn't exist :()
Contributor guide
Research direction
No implementation file, test, or entry point is named. Reproduce the assignment example and inspect how list.copy() is currently typed; determine a supported way to make the result assignable to list[object]. Done means the example type-checks without an invariance error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100