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: stubmethods: nil deref of FuncType.Results in fromReturnStmt #70967

Open
adonovan opened this issue Dec 23, 2024 · 2 comments
Open
Labels
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 Dec 23, 2024

#!stacks
"runtime.sigpanic" && ("fromReturnStmt:+26" || "fromReturnStmt:+27")

Issue created by stacks.

Oops, the Results field is optional, and in any case NumFields is the correct measure:

	if len(funcType.Results.List) != len(ret.Results) {
		return nil, fmt.Errorf("%d-operand return statement in %d-result function",
			len(ret.Results),
			len(funcType.Results.List))
	}

This stack ArQqdg was reported by telemetry:

golang.org/x/tools/[email protected] go1.23.3 darwin/arm64 other (5)
@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 Dec 23, 2024
@gopherbot gopherbot added this to the Unreleased milestone Dec 23, 2024
@adonovan adonovan modified the milestones: Unreleased, gopls/v0.17.2 Dec 23, 2024
@adonovan
Copy link
Member Author

I think this was fixed in passing by https://go.dev/cl/623156 which changed it to:

	rets := sig.Results()
	// The return operands and function results must match.
	// (Spread returns were rejected earlier.)
	if rets.Len() != len(ret.Results) {
		return nil, fmt.Errorf("%d-operand return statement in %d-result function",
			len(ret.Results),
			rets.Len())
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

3 participants