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: incorrect literal completion for identical struct #46113

Closed
muirdm opened this issue May 12, 2021 · 1 comment
Closed

x/tools/gopls: incorrect literal completion for identical struct #46113

muirdm opened this issue May 12, 2021 · 1 comment
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@muirdm
Copy link

muirdm commented May 12, 2021

type foo struct { i int }
type bar struct { i int }

func _() {
	var _ foo = <>
}

At <>, "bar{}" is the top candidate. I think gopls sees that bar is convertible to foo so it thinks "bar{}" is a good candidate. The conversion (i.e. "foo(bar{})") is not present in the candidate because the literal candidate code doesn't support converting types. Anyway, gopls shouldn't offer literal candidates that require conversion.

/cc @psanford

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels May 12, 2021
@gopherbot gopherbot added this to the Unreleased milestone May 12, 2021
@findleyr findleyr modified the milestones: Unreleased, Backlog May 12, 2021
@stamblerre stamblerre modified the milestones: Backlog, gopls/unplanned May 12, 2021
@gopherbot
Copy link

Change https://golang.org/cl/319509 mentions this issue: lsp/completion: don't offer literal candidates requiring conversion

@golang golang locked and limited conversation to collaborators May 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. 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