Skip to content

Comments

Better match narrowing for type objects#20872

Open
hauntsaninja wants to merge 1 commit intopython:masterfrom
hauntsaninja:narrow101
Open

Better match narrowing for type objects#20872
hauntsaninja wants to merge 1 commit intopython:masterfrom
hauntsaninja:narrow101

Conversation

@hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Feb 23, 2026

This is the more general fix I alluded to in
#20367 (comment)

The tests I added do not yet have perfect behaviour, e.g. the type object unions should be allowed and should not have the branch marked as unreachable. I will open a PR for that next (it is easy, but the diff is thrashier so better for a separate PR)

Fixes #18470 , fixes comment in #17133 (comment)

@github-actions

This comment has been minimized.

This is the more general fix I alluded to in
python#20367 (comment)
@github-actions
Copy link
Contributor

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

Sign up for free to 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.

Cannot infer type of generic type parm in match case statement

1 participant