Title: [1.20 regression] Mypy incorrectly marks a match case as unreachable · Issue #21189 · python/mypy · GitHub
Open Graph Title: [1.20 regression] Mypy incorrectly marks a match case as unreachable · Issue #21189 · python/mypy
X Title: [1.20 regression] Mypy incorrectly marks a match case as unreachable · Issue #21189 · python/mypy
Description: I noticed this issue while updating the typing conformance tests. On this code snippet, which is taken from the tuples_type_compat conformance test, mypy 1.19.1 behaves correctly (errors on exactly one assert_type in each match case, sho...
Open Graph Description: I noticed this issue while updating the typing conformance tests. On this code snippet, which is taken from the tuples_type_compat conformance test, mypy 1.19.1 behaves correctly (errors on exactly...
X Description: I noticed this issue while updating the typing conformance tests. On this code snippet, which is taken from the tuples_type_compat conformance test, mypy 1.19.1 behaves correctly (errors on exactly...
Opengraph URL: https://github.com/python/mypy/issues/21189
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[1.20 regression] Mypy incorrectly marks a match case as unreachable","articleBody":"I noticed this issue while updating the typing conformance tests. On [this code snippet](https://mypy-play.net/?mypy=1.20.0\u0026python=3.12\u0026flags=warn-unreachable\u0026gist=6492575ead11bc9aff0002d70956c862), which is taken from the [tuples_type_compat](https://github.com/python/typing/blob/main/conformance/tests/tuples_type_compat.py) conformance test, mypy 1.19.1 behaves correctly (errors on exactly one assert_type in each match case, showing that it infers one of the two acceptable types in each case), whereas mypy 1.20.0 incorrectly marks the code in the last match case as unreachable.","author":{"url":"https://github.com/rchen152","@type":"Person","name":"rchen152"},"datePublished":"2026-04-08T21:36:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/21189/mypy/issues/21189"}
| 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:2faca3e1-9077-e7ed-f85e-9f4303e7ba70 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A252:1B8709:E04F47:1418CE6:6A59FF37 |
| html-safe-nonce | 3b802f45ae6bcff4b334eef123a24a47c3da54a246401ec4a02b124e2d6bb963 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjUyOjFCODcwOTpFMDRGNDc6MTQxOENFNjo2QTU5RkYzNyIsInZpc2l0b3JfaWQiOiI1MDMzNDA4MzgyMjY0NTQwOTgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | fdf5215e365e9ee3a75651c161970664f5c8a4c8891fa3ceb790507fc68a0a85 |
| hovercard-subject-tag | issue:4227810083 |
| 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/21189/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d96db215ae11a5dfe7addf726244e7dc2935c93ee973cefbd48e6e20ec5a07ad/python/mypy/issues/21189 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d96db215ae11a5dfe7addf726244e7dc2935c93ee973cefbd48e6e20ec5a07ad/python/mypy/issues/21189 |
| og:image:alt | I noticed this issue while updating the typing conformance tests. On this code snippet, which is taken from the tuples_type_compat conformance test, mypy 1.19.1 behaves correctly (errors on exactly... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rchen152 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4d3f961cfc83a4348ee5be7691cf4ae3515aab3ef5200c13a7e41b048125fb61 |
| 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 | ac4d28603af300ac851b62521abb878ab5d3319a |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width