KEMBAR78
Union types: Support narrowing to `Ellipsis` (`...`) cases of `Unions` by vlaci · Pull Request #13157 · python/mypy · GitHub
Skip to content

Conversation

vlaci
Copy link
Contributor

@vlaci vlaci commented Jul 16, 2022

After this change, narrowing to Ellipsis works similarly with
regards to narrowing as None in Optionals

It would be a good followup refactor to delegate some of the logic
from is_singleton_type to the actual mypy types so they could decide
for themselves if they are representing singleton objects

Fixes: #13117
Co-authored-by: Zsolt Cserna cserna.zsolt@gmail.com

@github-actions

This comment has been minimized.

After this change, narrowing to `Ellipsis` works similarly with
regards to narrowing as `None` in `Optional`s

It would be a good followup refactor to delegate some of the logic
from `is_singleton_type` to the actual mypy types so they could decide
for themselves if they are representing singleton objects

Fixes: python#13117
Co-authored-by: Zsolt Cserna <cserna.zsolt@gmail.com>
Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

LGTM.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@ilevkivskyi ilevkivskyi merged commit b6d525d into python:master Jul 17, 2022
@vlaci vlaci deleted the ellipsis branch July 17, 2022 10:11
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.

Unable to narrow unions including EllipsisType or NoneType using the identity of their singleton

3 participants