KotlinIsland / KotlinIsland/basedmypy

Support `TypeExpr` types

Open
#463 1 comment 0 reactions 0 assignees View on GitHub
basedtyping feature
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

```py
def f(t: TypeExpr[T]) -> T: ...

reveal_type(f(int | str)) # int | str

a: TypeExpr[int | str]
a = int | str # valid UnionType
a = int # valid int
a = 1 # valid, bare literal
a = object # invalid, object isn't a subtype of int | str
```

I can imagine a lot of cases where there is ambiguous stuff like `t: TypeExpr[Any]`, so we can just ban those ones.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by locating the type-checker code that handles annotations and union/type expressions, then define and test the shown TypeExpr cases, including the rejected object assignment and the ambiguous Any cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.