Skip to content

Properly expand type in generic class with Self and TypeVar with values#14491

Merged
JukkaL merged 1 commit intopython:masterfrom
ilevkivskyi:fix-self-values
Jan 21, 2023
Merged

Properly expand type in generic class with Self and TypeVar with values#14491
JukkaL merged 1 commit intopython:masterfrom
ilevkivskyi:fix-self-values

Conversation

@ilevkivskyi
Copy link
Copy Markdown
Member

Fixes #14374

It looks like we need to special-case Self in expand_type() to support it in generics over TypeVar with values, since Self is the only type variable that can legitimately have other type variables in its upper bound.

@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Copy Markdown
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to have this fixed in 1.0!

@JukkaL JukkaL merged commit cc1bcc9 into python:master Jan 21, 2023
@ilevkivskyi ilevkivskyi deleted the fix-self-values branch January 21, 2023 18:01
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.

TypeVar with values has incompatible type when used Self

2 participants