Skip to content

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Aug 21, 2025

Mypy creates a union type for the pattern subject in an or pattern already. Use union for captured variables as well.

@cdce8p cdce8p added the topic-match-statement Python 3.10's match statement label Aug 21, 2025
Copy link
Contributor

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

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks!

@hauntsaninja hauntsaninja merged commit 01e2a8c into python:master Aug 22, 2025
20 checks passed
@cdce8p cdce8p deleted the match-or-union branch August 22, 2025 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-match-statement Python 3.10's match statement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants