mirror of
https://github.com/golang/go
synced 2024-11-18 20:34:39 -07:00
9d59f9e855
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> |
||
---|---|---|
.. | ||
assign_rank.go.in | ||
binexpr_rank.go.in | ||
convert_rank.go.in | ||
switch_rank.go.in | ||
type_assert_rank.go.in | ||
type_switch_rank.go.in |