KotlinIsland / KotlinIsland/basedmypy

narrowing gets very broken with intersections

Open
#442 1 comment 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
class A: pass
class B: pass
class C: pass

x: A
assert isinstance(x, B | C)
assert isinstance(x, C)
reveal_type(x) # A & C
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the narrowing behavior with the Python snippet in the issue and inspect basedmypy’s type-narrowing and intersection handling. Determine the intended revealed type after the two isinstance assertions, then add a regression test showing the corrected result.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.