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
This commit is contained in:
Rob Pike 2013-08-06 16:19:10 +10:00
parent 45e3d57f32
commit 75920173e4

View File

@ -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.