Reviewed all uses of underIs (global function and method) and made
sure we are ok with a nil incoming argument (indicating a type set
with no specific types).
Added a couple of checks where we didn't have them (and somehow
didn't run into a problem yet).
Change-Id: Ifde45a3a80ddf2b1a19c83f79258ad8207dfb09f
Reviewed-on: https://go-review.googlesource.com/c/go/+/363658
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
case *TypeParam:
// TODO(gri) review this code - doesn't look quite right
ok := u.underIs(func(t Type) bool {
+ if t == nil {
+ return false
+ }
target, _, _ := check.implicitTypeAndValue(x, t)
return target != nil
})
case *Slice, *Pointer, *Signature, *Interface, *Map, *Chan:
return true
case *TypeParam:
- return u.underIs(hasNil)
+ return u.underIs(func(u Type) bool {
+ return u != nil && hasNil(u)
+ })
}
return false
}
func structuralType(typ Type) Type {
var su Type
if underIs(typ, func(u Type) bool {
+ if u == nil {
+ return false
+ }
if su != nil {
u = match(su, u)
if u == nil {