Title: [1.16 regression] determining exhaustive match on an enum with type members · Issue #19151 · python/mypy · GitHub
Open Graph Title: [1.16 regression] determining exhaustive match on an enum with type members · Issue #19151 · python/mypy
X Title: [1.16 regression] determining exhaustive match on an enum with type members · Issue #19151 · python/mypy
Description: Hi, I continued looking at how the codebase I work on responds to the upcoming mypy 1.16 release and I believe I found another bug import datetime import enum from typing import assert_never class ValueType(enum.Enum): BOOLEAN = bool DAT...
Open Graph Description: Hi, I continued looking at how the codebase I work on responds to the upcoming mypy 1.16 release and I believe I found another bug import datetime import enum from typing import assert_never class ...
X Description: Hi, I continued looking at how the codebase I work on responds to the upcoming mypy 1.16 release and I believe I found another bug import datetime import enum from typing import assert_never class ...
Opengraph URL: https://github.com/python/mypy/issues/19151
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[1.16 regression] determining exhaustive match on an enum with type members","articleBody":"Hi,\n\nI continued looking at how the codebase I work on responds to the upcoming mypy 1.16 release and I believe I found another bug\n\n```python\nimport datetime\nimport enum\nfrom typing import assert_never\n\n\nclass ValueType(enum.Enum):\n BOOLEAN = bool\n DATE = datetime.date\n DATETIME = datetime.datetime\n\n\nvalue_type: ValueType = ValueType.BOOLEAN\n\nmatch value_type:\n case ValueType.BOOLEAN:\n pass\n case ValueType.DATE:\n pass\n case ValueType.DATETIME:\n pass\n case _:\n assert_never(value_type)\n```\n\nOn mypy 1.16 I get this error\n\n```\na.py:22: error: Argument 1 to \"assert_never\" has incompatible type \"ValueType\"; expected \"Never\" [arg-type]\n```\n\nAs far as I can tell this should be correct and I'm unsure why it doesn't think I have an exhaustive match.\n\n**Your Environment**\n\n\n- Mypy version used: release-1.16 (revision 96525a23f, built locally with mypy_mypyc-wheels for cp312-macosx_arm64)\n- Mypy command-line flags: `mypy a.py`\n- Mypy configuration options from `mypy.ini` (and other config files): no config\n- Python version used: python3.12\n","author":{"url":"https://github.com/delfick","@type":"Person","name":"delfick"},"datePublished":"2025-05-26T08:25:41Z","url":"https://github.com/python/mypy/issues/19151"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a7fa9bbd-9548-2518-68d0-1554087e2dfc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AC32:142FA7:CDE62:1156D7:6B001CD6 |
| html-safe-nonce | 4c47556a40ed064782c477d4d0e6d16f6638e8c70fcd269cfd15cc42b54b016a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQzMyOjE0MkZBNzpDREU2MjoxMTU2RDc6NkIwMDFDRDYiLCJ2aXNpdG9yX2lkIjoiNDI2NDM4MDI1ODY5OTk3NTg5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d91a13690e3d1a7b0974b4930fb43659818f81e3cb0c8fc6ff996dd291465d81 |
| hovercard-subject-tag | issue:3090420690 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/19151/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b96a24740935bc7469857995506bcd20a71a1c56a276922f46965390f2c0f846/python/mypy/issues/19151 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b96a24740935bc7469857995506bcd20a71a1c56a276922f46965390f2c0f846/python/mypy/issues/19151 |
| og:image:alt | Hi, I continued looking at how the codebase I work on responds to the upcoming mypy 1.16 release and I believe I found another bug import datetime import enum from typing import assert_never class ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | delfick |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width