mirror of
https://github.com/golang/go
synced 2024-11-19 00:54:42 -07:00
3721262b3e
We now support taking the address of objects to make better completion candidates. For example: i := 123 var p *int = <> // now you get a candidate for "&i" This required that we track addressability better, particularly when searching for deep candidates. Now each candidate knows if it is addressable, and the deep search propagates addressability to child candidates appropriately. The basic propagation logic is: - In-scope *types.Var candidates are addressable. This handles your basic "foo" variable whose address if "&foo". - Surrounding selector is addressable based on type checker info. This knows "foo.bar.<>" is addressable but "foo.bar().<>" isn't - When evaluating deep completions, fields after a function call lose addressability, but fields after a pointer regain addressability. For example, "foo.bar()" isn't addressable, but "foo.bar().baz" is addressable if "bar()" returns a pointer. Fixes golang/go#36132. Change-Id: I6a8659eb8c203262aedf86844ac39a2d1e81ecc4 Reviewed-on: https://go-review.googlesource.com/c/tools/+/212399 Run-TryBot: Muir Manders <muir@mnd.rs> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org> |
||
---|---|---|
.. | ||
channel.go |