aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Findley <rfindley@google.com>2023-05-12 11:31:28 -0400
committerRobert Findley <rfindley@google.com>2023-05-12 15:47:10 +0000
commitcecf8b93283dd9fddacdf05db583644a2f3b0bbb (patch)
tree17c8787332bc21bcf0c0211c5979e0bb992abc86 /src
parent803a7dfb80ace1fe31528a81ed7bb6ab56b5d930 (diff)
downloadgo-cecf8b93283dd9fddacdf05db583644a2f3b0bbb.tar.xz
go/types: minor refactoring of missingMethod following CL 494615
Make the refactoring suggested by gri@ in that CL. Change-Id: I6c363f3ba5aaa3c616d3982d998b989de7046a86 Reviewed-on: https://go-review.googlesource.com/c/go/+/494617 Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/types2/lookup.go11
-rw-r--r--src/go/types/lookup.go11
2 files changed, 14 insertions, 8 deletions
diff --git a/src/cmd/compile/internal/types2/lookup.go b/src/cmd/compile/internal/types2/lookup.go
index ccf724373b..b7370ca38d 100644
--- a/src/cmd/compile/internal/types2/lookup.go
+++ b/src/cmd/compile/internal/types2/lookup.go
@@ -387,10 +387,6 @@ func (check *Checker) missingMethod(V, T Type, static bool, equivalent func(x, y
obj, _, _ = lookupFieldOrMethodImpl(V, false, m.pkg, m.name, true /* fold case */)
f, _ = obj.(*Func)
if f != nil {
- // This method is formatted in funcString below, so must be type-checked.
- if check != nil {
- check.objDecl(f, nil)
- }
state = wrongName
}
}
@@ -421,6 +417,13 @@ func (check *Checker) missingMethod(V, T Type, static bool, equivalent func(x, y
}
if cause != nil {
+ if f != nil {
+ // This method may be formatted in funcString below, so must have a fully
+ // set up signature.
+ if check != nil {
+ check.objDecl(f, nil)
+ }
+ }
switch state {
case notFound:
switch {
diff --git a/src/go/types/lookup.go b/src/go/types/lookup.go
index 0ff5db74e6..d96dd86e5e 100644
--- a/src/go/types/lookup.go
+++ b/src/go/types/lookup.go
@@ -389,10 +389,6 @@ func (check *Checker) missingMethod(V, T Type, static bool, equivalent func(x, y
obj, _, _ = lookupFieldOrMethodImpl(V, false, m.pkg, m.name, true /* fold case */)
f, _ = obj.(*Func)
if f != nil {
- // This method is formatted in funcString below, so must be type-checked.
- if check != nil {
- check.objDecl(f, nil)
- }
state = wrongName
}
}
@@ -423,6 +419,13 @@ func (check *Checker) missingMethod(V, T Type, static bool, equivalent func(x, y
}
if cause != nil {
+ if f != nil {
+ // This method may be formatted in funcString below, so must have a fully
+ // set up signature.
+ if check != nil {
+ check.objDecl(f, nil)
+ }
+ }
switch state {
case notFound:
switch {