Skip to content

Better match narrowing for irrefutable sequence patterns - #20782

Merged
hauntsaninja merged 2 commits into
python:masterfrom
hauntsaninja:narrow95
Feb 19, 2026
Merged

Better match narrowing for irrefutable sequence patterns#20782
hauntsaninja merged 2 commits into
python:masterfrom
hauntsaninja:narrow95

Conversation

@hauntsaninja

@hauntsaninjahauntsaninja commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

The changes around narrow_sequence_child:

Fixes#13955
Helps with things in #19081

The changes around narrow_sequence_child:
- implement my suggestion from here:
python#18091 (review)
- remove an is_subtype check I don't understand
@hauntsaninjahauntsaninja mentioned this pull request Feb 11, 2026
@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. ✅

@hauntsaninja

Copy link
Copy Markdown
CollaboratorAuthor

Will merge this one tomorrow

@hauntsaninja
hauntsaninja merged commit 688121a into python:masterFeb 19, 2026
23 checks passed
@hauntsaninja
hauntsaninja deleted the narrow95 branch February 19, 2026 23:33
hauntsaninja added a commit that referenced this pull request Mar 4, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No narrowing of sequence types after a sequence pattern case in a match statement

2 participants

@hauntsaninja@JukkaL