microsoft / microsoft/pyright

Inconsistency between override validation and protocol matching

Open
#10,216 0 comments 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

When a protocol method involves a type variable used to annotate self, there are inconsistencies between protocol matching and explicit protocol subclassing. This can be seen in the protocol53.py test case. This inconsistency is a regression introduced in this change.

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 protocol53.py test case and compare protocol matching with explicit protocol subclassing for methods whose self annotation uses a type variable. Review commit 4e847ba729b3722005d745d82c80816471db38ef to identify the regression. Done means the two validation paths handle this case consistently and the test captures the corrected behavior.

Written by the indexing model from the issue text.

Assessment

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