Skip to content

x/tools/gopls/internal/analysis/unusedparams: "no such param" error when applying fix #76205

@adonovan

Description

@adonovan

gopls' unusedparams analyzer is spuriously reporting a diagnostic for an unused parameter in a func literal even when the func value is address taken, in this case by being assigned to a global variable of a particular func type:

var g func(x, y int)

func _() {
	g = func(x, y int) { // unused parameter: x
		print(y)
	}
}

The existing logic is supposed to recognize when a func lit is assigned to a func-typed var whose type it must conform to, but clearly it has a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RefactoringIssues related to refactoring toolsToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions