1
0
mirror of https://github.com/golang/go synced 2024-10-01 16:08:33 -06:00
go/internal/lsp/testdata/keywords/accidental_keywords.go.in
Muir Manders 73c7173a9f internal/lsp: fix AST bookkeeping as we repair nodes
We weren't maintaining our ancestor node list correctly. This caused
us to fail to make AST repairs in certain cases. Now we are careful to
always append to the ancestors list when recursing.

Updates golang/go#34332.

Change-Id: I9b51ec70572170d9f592060d264c98b1f9720fb8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/209966
Run-TryBot: Muir Manders <muir@mnd.rs>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-12-05 06:08:18 +00:00

26 lines
607 B
Go

package keywords
// non-matching candidate - shouldn't show up as completion
var apple = "apple"
func _() {
foo.bar() // insert some extra statements to excercise our AST surgery
variance := 123 //@item(kwVariance, "variance", "int", "var")
foo.bar()
println(var) //@complete(")", kwVariance)
}
func _() {
foo.bar()
var s struct { variance int } //@item(kwVarianceField, "variance", "int", "field")
foo.bar()
s.var //@complete(" //", kwVarianceField)
}
func _() {
foo.bar()
var typeName string //@item(kwTypeName, "typeName", "string", "var")
foo.bar()
type //@complete(" //", kwTypeName)
}