-
Notifications
You must be signed in to change notification settings - Fork 196
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
Qualify imported symbols when the dequalified form would cause a conflict #674
Conversation
Codecov Report
@@ Coverage Diff @@
## main #674 +/- ##
========================================
Coverage 94.80% 94.81%
========================================
Files 246 246
Lines 25453 25591 +138
========================================
+ Hits 24131 24263 +132
- Misses 1322 1328 +6
Continue to review full report at Codecov.
|
…lict. Adds a preliminary pass that scans the stub file for all imported symbols, and collects the ones that cannot be safely dequalified. Fixes #673
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.
This looks good to me, up to being a bit too abbreviation-heavy for the existing style.
But it looks to me like it probably only handles collisions within the stub - that's all that's tested, and as far as I can tell we're only running import_gatherer
on the stub.
If that's the case, we should consider also handling collisions with the existing code - I'm fine with deferring that (I could try adding it later) but curious if it would be easy to add right now since you already have context.
handling collisions in the existing code looks simple enough to add to this PR after all, will push an update. |
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.
Nice, this looks good.
Pyre is complaining about a couple of lines. We don't yet have proper github integration (hopefully in a couple of weeks!) so it's a pain to find the problem, I commented on the relevant lines
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 good!
Thanks for the fix @martindemello - I've been wanting to handle this edge case for a long time, we actually hit it pretty often in |
i've been wanting to handle it for a while too :) imports are the last thing blocking us from using this in pytype. |
Summary
Adds a preliminary pass that scans the stub file for all imported
symbols, and collects the ones that cannot be safely dequalified.
Fixes #673
Test Plan
Added a test case to test_apply_type_annotations.