microsoft / microsoft/pyright

Generic nested classes cannot reference each other

Open
#11,227 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
15.6k
Forks
1.8k
Avg merge
12h 13m
Merged PRs (30d)
52

Description

Describe the bug
Nested classes aren't given the correct lookup table in generic parameters

Code or Screenshots
https://pyright-play.net/?code=MYGwhgzhAEBiD28DaAVAugLmgOlwKD1EhgGUBXAJwDMxgBTAETqoDsM9pPoAiX862nWgBzCmAAOACwCWwGABNm0ltIAu0%2BC2y9uBLtCJRoiqsrUaWACgTJu-GvSatuaAJTt9%2BnSXF1g0qgBPaAhKByETM3VNaFVA321ePU9OQxhxcBY6AH1QgXprRCRuSJVolhd3DhTPXGwgA

VS Code extension or command-line
pyright: 1.1.408

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked pyright-play reproduction and confirm the incorrect lookup behavior for generic parameters in nested classes. Trace the relevant type-resolution path in the pyright codebase; done means nested classes can reference each other through generic parameters with the correct lookup table.

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.