KotlinIsland / KotlinIsland/basedmypy

Warn on redundant union entries

Open
#65 0 comments 0 reactions 0 assignees View on GitHub
feature p-3
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

I think it would help with understand-ability and discover-ability of certain parts of the python type system.
things such as:
- duck typing
- `bool` extends `int`
- `NoneType` extends `object`

```py
i: int | bool = 1
f: float | int = 1
b: bytes | bytearray | memoryview = b''
o: object | None = "AMONGUS"
```
I would expect all these to trigger warnings that the types are redundant.

Contributor guide

Open the contributing guide

Research direction

No source file, test, or entry point is identified in the issue. Start by finding where basedmypy analyzes union members and emits type diagnostics, then trace how subtype relationships are represented. Done means redundant entries such as int | bool and object | None produce warnings, with coverage for the examples in the issue.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.