1
0
mirror of https://github.com/golang/go synced 2024-11-19 02:24:41 -07:00
go/internal/lsp/testdata/builtins
Muir Manders d31a08c2ed internal/lsp/source: improve completion support for args to builtins
We now understand what "kind" of type is expected when using various
builtins. For example, when completing "close(<>)" we prefer channels,
and when completing "delete(<>)" we prefer maps.

I also added some code to infer the expected type for the second
argument to "delete()" and for the args to "copy()":

delete(map[someType]int{}, <>) // expect "someType"

copy([]int{}, <>) // expect "[]int"
copy(<>, []int{}) // expect "[]int"

And I marked "new()" as expected a type name, and it infers the type
name properly:

var _ *int = new(<>) // expected type at "<>" is "int"

Fixes golang/go#36326.

Change-Id: I4295c8753f8341d47010a0553fd2d0c2586f2efa
Reviewed-on: https://go-review.googlesource.com/c/tools/+/212957
Run-TryBot: Muir Manders <muir@mnd.rs>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-01-14 05:24:53 +00:00
..
builtin_args.go internal/lsp/source: improve completion support for args to builtins 2020-01-14 05:24:53 +00:00
builtins.go internal/lsp: downrank "nil" completion candidate 2019-12-12 05:12:00 +00:00
constants.go internal/lsp/source: don't downrank builtin constant completions 2020-01-07 18:15:58 +00:00