1
0
mirror of https://github.com/golang/go synced 2024-11-19 03:44:40 -07:00
go/internal/lsp/testdata/good/good1.go
Rebecca Stambler 6e267b5cc7 internal/lsp: add additional tests for completion
New tests include cases for anonymous structs, composite literals,
ranking of results in binary expressions, and import cycles.

Change-Id: Ic02e84e09101bb9873fc1705bba2594d655bb45b
Reviewed-on: https://go-review.googlesource.com/c/153443
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-12-19 22:27:14 +00:00

20 lines
603 B
Go

package good //@diag("package", "")
import (
"golang.org/x/tools/internal/lsp/types" //@item(types_import, "types", "\"golang.org/x/tools/internal/lsp/types\"", "package")
)
func random() int { //@item(good_random, "random()", "int", "func")
y := 6 + 7
return y
}
func random2(y int) int { //@item(good_random2, "random2(y int)", "int", "func"),item(good_y_param, "y", "int", "var")
//@complete("", good_y_param, types_import, good_random, good_random2, good_stuff)
var b types.Bob = &types.X{}
if _, ok := b.(*types.X); ok { //@complete("X", Bob_interface, X_struct, Y_struct)
}
return y
}