mirror of https://github.com/golang/go.git
internal/lsp/source: avoid using go/types.Implements with Typ[Invalid]
go/types predicates are undefined on types.Typ[types.Invalid]. Avoid using types.Implements with invalid types in one place. For golang/go##53595 Change-Id: I48cff1681dc7d4f59ea815e5a0d58e0160990c82 Reviewed-on: https://go-review.googlesource.com/c/tools/+/452475 Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> gopls-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
db5eae2178
commit
41c70c91bc
|
|
@ -271,7 +271,8 @@ func (a *postfixTmplArgs) VarName(t types.Type, nonNamedDefault string) string {
|
|||
}
|
||||
|
||||
var name string
|
||||
if types.Implements(t, errorIntf) {
|
||||
// go/types predicates are undefined on types.Typ[types.Invalid].
|
||||
if !types.Identical(t, types.Typ[types.Invalid]) && types.Implements(t, errorIntf) {
|
||||
name = "err"
|
||||
} else if _, isNamed := source.Deref(t).(*types.Named); !isNamed {
|
||||
name = nonNamedDefault
|
||||
|
|
|
|||
Loading…
Reference in New Issue