From 75920173e4c0a4057c258aea2f1a72ba75ca4b51 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Tue, 6 Aug 2013 16:19:10 +1000 Subject: [PATCH] go.tools/go/types: don't put an interface nil into the Objects map If a method cannot type check, we end up with the interface variable m to hold <*Func, nil>. Don't put that in the map because it defeats the usual != nil check. R=gri, dsymonds CC=golang-dev https://golang.org/cl/12506043 --- go/types/resolver.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/go/types/resolver.go b/go/types/resolver.go index 4e8ae7e0bc..290d7cbc78 100644 --- a/go/types/resolver.go +++ b/go/types/resolver.go @@ -544,11 +544,10 @@ func (check *checker) typeDecl(obj *TypeName, typ ast.Expr, def *Named, cycleOk m = nil } - check.recordObject(ident, m) - // If the method is valid, type-check its signature, // and collect it with the named base type. if m != nil { + check.recordObject(ident, m) check.objDecl(m, nil, true) // Methods with blank _ names cannot be found. // Don't add them to the method list.