1
0
mirror of https://github.com/golang/go synced 2024-11-06 17:46:21 -07:00
go/internal/lsp/testdata/rank
Muir Manders 9d59f9e855 internal/lsp: improve completion support for untyped constants
Add some extra smarts when evaluating untyped constants as completion
candidates. Previously we called types.Default() on the expected type
and candidate type, but this loses the untypedness of an untyped
constant which prevents it from being assignable to any type or named
type other than the untyped constant's default type.

Note that the added logic does not take into account the untyped
constant's value, so you will still get some false positive
completions (e.g. suggesting an untyped negative integer constant when
only a uint would do). Unfortunately go/types doesn't provide a way of
answering the question "is this *types.Const assignable to this
types.Type" since types.AssignableTo only considers a constant's type,
not its value.

Change-Id: If7075642e928f712b127256ae7706a5190e2f42c
GitHub-Last-Rev: 124d2f05b0aec09c9d7004d9da0d900524185b92
GitHub-Pull-Request: golang/tools#128
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184477
Reviewed-by: Suzy Mueller <suzmue@golang.org>
2019-07-03 16:30:32 +00:00
..
assign_rank.go.in
binexpr_rank.go.in
convert_rank.go.in internal/lsp: improve completion support for untyped constants 2019-07-03 16:30:32 +00:00
switch_rank.go.in internal/lsp: handle more expected type cases 2019-05-16 16:26:11 +00:00
type_assert_rank.go.in internal/lsp: handle more expected type cases 2019-05-16 16:26:11 +00:00
type_switch_rank.go.in internal/lsp: handle more expected type cases 2019-05-16 16:26:11 +00:00