KotlinIsland / KotlinIsland/basedmypy

issue with intersection compatibility with nested union

Open
#856 0 comments 0 reactions 0 assignees View on GitHub
bug topic-intersection
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

```py
from __future__ import annotations

class A: ...
class B: ...
class C: ...

a: A & (B | C)
b: A & (B | C) = a # Incompatible types in assignment (expression has type "A & B | C", variable has type "A & B | C")
```

Contributor guide

Open the contributing guide

Research direction

Start with the Python reproducer in the issue and run it through basedmypy to confirm the incompatible-assignment diagnostic. Trace the type-checking path for intersections nested inside unions, then add a regression test using this example; done means the compatible assignment is accepted without the diagnostic.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.