-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal: support renaming packages with int. test variants
We need to search intermediate test variants to find all imports of a renamed package, but were missing them because we only considered "active packages". Fix this by building up the set of renamed packages based on metadata alone: it is unnecessary and potentially too costly to request all (typechecked) known packages, when we only need access to the metadata graph to determine which packages must be renamed. In doing so, it becomes possible that we produce duplicate edits by renaming through a test variant. Avoid this by keeping track of import path changes that we have already processed. While at it, add a few more checks for package renaming: - check for valid identifiers - disallow renaming x_test packages - disallow renaming to x_test packages Also refactor package renaming slightly to pass around an edit map. This fixes a bug where nested import paths were not renamed in the original renaming package. Fix some testing bugs that were exercised by new tests. For golang/go#41567 Change-Id: I18ab442b33a3ee5bf527f078dcaa81d47f0220c7 Reviewed-on: https://go-review.googlesource.com/c/tools/+/443637 Reviewed-by: Dylan Le <dungtuanle@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
- Loading branch information
Showing
11 changed files
with
501 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.