-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[suggest] Support refining existing type annotations #7838
Conversation
d2d1a9d
to
d9f19dd
Compare
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! I have some comments here.
d9f19dd
to
0ac4544
Compare
I've rewritten the merge logic completely to not use either meet or join |
Oh wow this one that is failing only under mypyc is going to be exciting. That is frankly super rare! |
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.
Looks great! I like the new logic.
mypy/suggestions.py
Outdated
new_items.append(lhs) | ||
|
||
# We don't ever want to drop None while making these things and | ||
# make_simplified_union calls join which cases |
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.
It looks like something is wrong with grammar here.
if isinstance(t, UnionType): | ||
return refine_union(t, s) | ||
|
||
return t |
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.
I would add couple special cases (not important however) for type
and tuple
. These two are represented by instances, but can be refined by Type[C]
and Tuple[X, Y, ...]
.
The failure with mypyc is due to #7854 |
1fa48db
to
66d3cc0
Compare
No description provided.