Skip to content

Conversation

@hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Jan 31, 2026

In the future, it would be nice to have an option to continue to check unreachable code. See #18707 from A5rocks. This PR lays some semantics preserving groundwork for that.

This is effectively a subset of #18707 , but I go just a little bit further and change the type of TypeMap to exclude None

Btw A5rocks if you are willing to rebase your PR, that would be great. I think --check-unreachable will be a very useful feature.

Co-authored-by: A5rocks

@hauntsaninja hauntsaninja changed the title preserve type info in unreachable branches Preserve narrowing in unreachable code Jan 31, 2026
@github-actions
Copy link
Contributor

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 January 31, 2026 05:07
@hauntsaninja hauntsaninja requested a review from A5rocks January 31, 2026 05:08
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.

1 participant