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

x/tools/gopls: "inline: corrupted reference %v" bug in golang.RemoveUnusedParameter #69896

Closed
adonovan opened this issue Oct 15, 2024 · 5 comments
Assignees
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Oct 15, 2024

#!stacks
"bug.Errorf" && "golang.inlineAllCalls:+98"

Issue created by stacks.

		// Sanity check.
		if obj := refpkg.TypesInfo().ObjectOf(name); obj == nil ||
			obj.Name() != origDecl.Name.Name ||
			obj.Pkg() == nil ||
			obj.Pkg().Path() != string(pkg.Metadata().PkgPath) {
			return nil, bug.Errorf("cannot inline: corrupted reference %v", ref)
		}

This stack u1wk7A was reported by telemetry:

golang.org/x/tools/gopls@v0.16.2 go1.22.2 darwin/arm64 vscode (1)

Dups: vmzEcA

@adonovan adonovan added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. gopls/telemetry-wins labels Oct 15, 2024
@gopherbot gopherbot added this to the Unreleased milestone Oct 15, 2024
@adonovan
Copy link
Member Author

The failing assertion checks that each reference to the function or method of interest is a call to to a symbol with the same name and package as the original function. But the References algorithm returns implicit matches by joining with the "implements" relation, and these matches may come from arbitrary packages. So I think the assertion is overly strict.

@findleyr findleyr self-assigned this Nov 15, 2024
@findleyr
Copy link
Member

Thanks, that was indeed it, and I was able to reproduce.

Fix incoming.

@findleyr findleyr added the FixPending Issues that have a fix which has not yet been reviewed or submitted. label Nov 15, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/628376 mentions this issue: gopls/internal/golang: don't try to inline dynamic calls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants