Skip to content

fix __get__ overload with self-type Concatenate[ObjT, P1] + sibling TypeVar R1 still unmatched after #4415 #4592 - #4680

Open
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:4592
Open

fix __get__ overload with self-type Concatenate[ObjT, P1] + sibling TypeVar R1 still unmatched after #4415 #4592#4680
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:4592

Conversation

@asukaminato0721

@asukaminato0721 asukaminato0721 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #4592

Fixes ParamSpec inference for generic classes when the expected type contains an unsolved Concatenate[...] pattern.

Because ParamSpec subtyping already follows callable-parameter direction, applying contravariant class variance again prevents the concrete parameter list from being decomposed during inference.

This allows descriptor __get__ overloads using Concatenate[ObjT, P] and a sibling return TypeVar to resolve correctly, while preserving existing callable-residual behavior.

Test Plan

add test.

@meta-codesync

meta-codesync Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D117547438. (Because this pull request was imported automatically, there will not be any future comments.)

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

__get__ overload with self-type Concatenate[ObjT, P1] + sibling TypeVar R1 still unmatched after #4415

2 participants