python / python/mypy

Traverse also generated TypeInfos, methods and attributes

Open
#6,408 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs discussion semantic-analyzer
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

TraverserVisitor doesn't traverse generated TypeInfos (for things like call based enums) or methods (for named tuples). Perhaps it should? A concrete effect is that some checks such as type arg compatibility checks may not be performed for generated nodes. Arguably this is fine from a correctness viewpoint, since creating an invalid type is a bug in mypy or a plugin. However, this makes it harder to ensure that generated nodes are valid.

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 by locating TraverserVisitor and inspect how it traverses generated TypeInfos, methods, and attributes, including nodes produced for call-based enums and named tuples. Determine the intended traversal behavior and add coverage showing that checks such as type argument compatibility are applied to generated nodes; done means the relevant generated nodes are traversed consistently.

Written by the indexing model from the issue text.

Assessment

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