Skip to content

Further improve match statement narrowing against unions#20744

Open
hauntsaninja wants to merge 2 commits intopython:masterfrom
hauntsaninja:matchtup
Open

Further improve match statement narrowing against unions#20744
hauntsaninja wants to merge 2 commits intopython:masterfrom
hauntsaninja:matchtup

Conversation

@hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Feb 5, 2026

I realised there is a simpler and more complete approach than the one taken in #19600.
This adds the new "Step 2" to the original code. Best way to review the diff is probably to check it out and review it squashed with #19600 , but really the net logic change is just "Step 2"

Fixes #15190
Fixes #17549
Fixes #17600
Mostly fixes #18039
Helps with things in #19081

I realised there is a simpler and more powerful approach than the one
taken in python#19600. This basically adds the new "Step 2" to the original
code.
@github-actions

This comment has been minimized.

@hauntsaninja hauntsaninja marked this pull request as draft February 5, 2026 08:24
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

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

@hauntsaninja hauntsaninja marked this pull request as ready for review February 5, 2026 21:40
@hauntsaninja hauntsaninja requested a review from JukkaL February 5, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant