Clean-up lookup functions in semanal.py

Open
#4,157 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
compilers

Research direction

Start in semanal.py and trace the six lookup functions and three related helpers through the second semantic-analysis pass and their callers. Decide on a consistent smaller API of three lookup functions and two helpers, then update affected callers and verify that semantic analysis still behaves correctly.

Written by the indexing model from the issue text.

Description

priority-1-normal refactoring semantic-analyzer

Second pass of semantic analysis has 6 lookup functions:

  • lookup
  • lookup_qualified
  • lookup_fully_qualified
  • lookup_fully_qualified_or_none
  • lookup_type_node

plus 3 related helpers:

  • builtin_type
  • named_type
  • named_type_or_none

I think 9 lookup functions is too much and can cause confusions (this happened to me several times). I think we can leave only 3 lookup functions plus 2 helpers.

Dominant language
Python
Stars
20.6k
Forks
3.3k
Avg merge
1d 18h
Merged PRs (30d)
54

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.

More from python/mypy

All issues in python/mypy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.