Skip to content

Handle Self wrapped in Annotated when checking the expected self type - #21928

Open
EmmanuelNiyonshuti wants to merge 1 commit into
python:masterfrom
EmmanuelNiyonshuti:fix-expected-annotated-self-type
Open

Handle Self wrapped in Annotated when checking the expected self type#21928
EmmanuelNiyonshuti wants to merge 1 commit into
python:masterfrom
EmmanuelNiyonshuti:fix-expected-annotated-self-type

Conversation

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor

Fixes #21917

Self wrapped in Annotated was not being recognized as an expected self type. This PR updates is_expected_self_type to recurse through Annotated when checking unbound types.

@EmmanuelNiyonshuti EmmanuelNiyonshuti changed the title andle Self wrapped in Annotated when checking the expected self type Handle Self wrapped in Annotated when checking the expected self type Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mypy errors on self: Annotated[Self, "tag"]

1 participant