1
0
mirror of https://github.com/golang/go synced 2024-10-01 10:28:31 -06:00
go/internal/lsp/testdata
Pontus Leitzler dc31b401ab internal/lsp/source: avoid panic in rename check
In a case where the type info for an ast.CompositeLit isn't found in
forEachLexicalRef(...) gopls will panic.

e.g. trying to rename "foo" where it is declared in this case:
func fn() {
	var foo bool
	make(map[string]bool
	if foo {
	}
}

Note the missing ')' after make.

This change will skip ast.CompositeLits if the type can't be found, and
that fixes the panic. But it also do rename the identifier as long as it
is possible, and I'm not convinced that we should allow rename at all if
the source can't be compiled.

Updates golang/go#39614

Change-Id: Ibb50b15ce4b31056f2f1da52a4dcab7b8b91a320
Reviewed-on: https://go-review.googlesource.com/c/tools/+/238042
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
2020-06-16 19:50:46 +00:00
..
indirect internal/lsp: plumb fillstruct through analysis 2020-06-15 21:22:08 +00:00
lsp internal/lsp/source: avoid panic in rename check 2020-06-16 19:50:46 +00:00
missingdep internal/lsp: plumb fillstruct through analysis 2020-06-15 21:22:08 +00:00
missingtwodep internal/lsp: plumb fillstruct through analysis 2020-06-15 21:22:08 +00:00
unused internal/lsp: plumb fillstruct through analysis 2020-06-15 21:22:08 +00:00
upgradedep internal/lsp: plumb fillstruct through analysis 2020-06-15 21:22:08 +00:00