microsoft / microsoft/pyright

Pyright hangs when a generic type alias definition refers to itself via typevar bound

Open
#10,364 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
15.6k
Forks
1.8k
Avg merge
12h 13m
Merged PRs (30d)
52

Description

**Code or Screenshots**
```python
type Foo[T: Foo] = T

def func[T](x: Foo[T]) -> T: ...
```

Contributor guide

Open the contributing guide

Research direction

Start by running the provided Python snippet in Pyright and confirming that analysis hangs on the self-referential generic type alias. Trace the type-alias and type-variable-bound handling to identify the loop, then add a regression test showing that this input completes without hanging.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
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.