python / python/mypy

Use new type inference as a primary mechanism

Open
#15,907 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature priority-1-normal topic-type-variables
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Depends on https://github.com/python/mypy/issues/15906. This is a follow-up for series started by https://github.com/python/mypy/pull/15287

Currently new (polymorphic) inference is used as a fallback if the traditional algorithm fails (one way or another). At some point we should switch to the new inference scheme entirely. This would include:

  • Use polymorphic inference during unification in subtyping.
  • Use polymorphic inference as primary mechanism for all inference passes (return type, arguments first pass, arguments second pass).
  • Move apply_poly() logic from checkexpr.py to applytype.py.

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 dependency issue #15906 and the follow-up series from pull request #15287. Read the current inference paths and the apply_poly() logic in checkexpr.py, then review applytype.py. Done means polymorphic inference is used during subtyping unification and as the primary mechanism for return-type and both argument inference passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.