KotlinIsland / KotlinIsland/basedmypy
Confusing error using intersection operator (`&`) in value position (eg `TypeVar` bounds)
Open
bug
topic-intersection
- Dominant language
- Python
- Stars
- 202
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
```python
from typing import TypeVar
class Foo: ...
class Bar: ...
T = TypeVar("T", bound=Foo & Bar)
# error: TypeVar "bound" must be a type
# error: Unsupported left operand type for & ("type[Foo]")
```
Something more like "Use quoted types or basedtyping.Intersection".
Contributor guide
Research direction
Start by reproducing the TypeVar example using an intersection expression in the bound value position. Trace where the reported errors are generated and update the diagnostic so it suggests quoted types or basedtyping.Intersection; done when this example produces the clearer guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100