mirror of
https://github.com/golang/go
synced 2024-11-19 02:24:41 -07:00
d31a08c2ed
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> |
||
---|---|---|
.. | ||
builtin_args.go | ||
builtins.go | ||
constants.go |