Clean up node kinds in SymbolTableNode
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reading the SymbolTableNode handling described in the issue and the linked discussion in PR 4080. Map the current LDEF, GDEF, and MDEF kinds, module references, and type-alias attributes before deciding how the proposed SymbolNode subclasses and MypyFile marker fit. Done means the special kind handling and kind attribute are replaced by the proposed scope-based structure without losing type-alias behavior.
Written by the indexing model from the issue text.
Description
It seems like we could remove the special handling of module references and other special node kinds in SymbolTableNode so that we could remove the kind attribute and replace it with a scope attribute, with only 3 possible values, corresponding to the current kinds LDEF, GDEF and MDEF. We'd create new SymbolNode subclasses for some of the node kinds. For module references we can perhaps just use a MypyFile target node as a marker. We could move some attributes that are specific to type aliases to live in the new SymbolNode subclass.
From https://github.com/python/mypy/pull/4080#discussion_r143480572:
@ilevkivskyi :
Type aliases are quite complicated (due to several corner cases). I tried to make some simplifications recently. It seems to me that we can introduce a dedicated SybmolNode (like Var or TypeInfo) and deprecate type_override and friends and just point .node to this new symbol node. This is major refactoring, but I think it may help.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 54
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python/mypy
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug topic-configuration topic-error-reporting
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100