Skip to content
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

Prevent aliased imports from colliding with existing imports #2052

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

damianw
Copy link
Contributor

@damianw damianw commented Dec 30, 2024

Fixes #2046.

The simplest solution seemed to be to also check against currently-imported names when generating import aliases -- if a name is already imported, use more segments. This introduced the possibility that we might run out of segments though, which I handled by appending underscores if we reach that condition.

  • docs/changelog.md has been updated if applicable
  • CLA signed.

@damianw damianw force-pushed the import-alias-collision branch 2 times, most recently from 714cbdb to ce2fbfe Compare December 30, 2024 19:06
@damianw damianw force-pushed the import-alias-collision branch from ce2fbfe to a4d5afe Compare December 30, 2024 19:10
@damianw damianw force-pushed the import-alias-collision branch from a4d5afe to 6e3f114 Compare December 30, 2024 19:12
@damianw damianw marked this pull request as ready for review December 30, 2024 19:13
@JakeWharton
Copy link
Collaborator

Will wait for others to check it out later this week, or next. It's an off week for everyone (or it should be).

Copy link
Collaborator

@Egorand Egorand left a comment

Choose a reason for hiding this comment

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

Looks good! Left a couple improvement suggestions, they're largely cosmetic since the the top priority is the correctness of generated aliases, but if you have the appetite for it - would be great to land them before merging!

Co-authored-by: Egor Andreevich <[email protected]>
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.

Import aliases may introduce new naming collisions
3 participants