Skip to content

Support enum.member for python3.11+ - #17382

Merged
JukkaL merged 4 commits into
masterfrom
issue-12841-member
Jun 14, 2024
Merged

JukkaL merged 4 commits into
masterfrom
issue-12841-member

Conversation

@sobolevn

@sobolevn sobolevn commented Jun 14, 2024 •

Copy link
Copy Markdown
Member

There are no tests for @enum.member used as a decorator, because I can only decorate classes and functions, which are not supported right now: https://mypy-play.net/?mypy=latest&python=3.12&gist=449ee8c12eba9f807cfc7832f1ea2c49

import enum

class A(enum.Enum):
    class x: ...

reveal_type(A.x)  # Revealed type is "def () -> __main__.A.x"

This issue is separate and rather complex, so I would prefer to solve it independently.

Refs #17376

@sobolevn
sobolevn requested review from AlexWaygood and JukkaL June 14, 2024 07:04

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice!

Comment thread mypy/plugins/enums.py Resolved
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

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

@JukkaL JukkaL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, looks good to me!

@JukkaL
JukkaL merged commit dac88f3 into master Jun 14, 2024
@JukkaL
JukkaL deleted the issue-12841-member branch June 14, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants