-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes type inference for generic calls in if
expr
#11128
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Ok, I will try to figure out what is going on. Looks like other commits into |
Yes, this problem is reproduced on from typing import TypeVar, Union, List
T1 = TypeVar("T1")
def promote_list(item: Union[T1, List[T1]]) -> List[T1]:
...
exprs: List[int]
reveal_type(promote_list(exprs)) I've opened a new issue: #11149 So, this can be considered as "ready to be reviewed". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! This seems like a promising approach. I want to check this with our big internal repository before merging, however. Even minor changes to type inference often cause unexpected false positives or other regressions.
FYI this has a merge conflict. |
@JelleZijlstra thanks! Resolved. |
Closes #11049