Skip to content

x/tools/gopls: nil Signature (?) deref in Completion #70634

Closed as not planned
Closed as not planned
@adonovan

Description

@adonovan
#!stacks
"runtime.sigpanic" && "go/types.(*Signature).Results:=94" && "expectedReturnStmtType"

Issue created by stacks.

// expectedReturnStmtType returns the expected type of a return statement.
// Returns nil if enclosingSig is nil.
func expectedReturnStmtType(enclosingSig *types.Signature, node *ast.ReturnStmt, pos token.Pos) types.Type {
	if enclosingSig != nil {
		if resultIdx := exprAtPos(pos, node.Results); resultIdx < len(node.Results) {
			return enclosingSig.Results().At(resultIdx).Type()
		}
	}
	return nil
}

This stack sZBuvA was reported by telemetry:

golang.org/x/tools/gopls@v0.17.0-pre.3 go1.23.3 darwin/arm64 other,vscode (10)

Dups: mCLZHw

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/telemetry-wins

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions