diff --git a/src/cmd/compile/internal/types2/sanitize.go b/src/cmd/compile/internal/types2/sanitize.go index 8b8bc72d85..64a2dedc7d 100644 --- a/src/cmd/compile/internal/types2/sanitize.go +++ b/src/cmd/compile/internal/types2/sanitize.go @@ -67,13 +67,17 @@ func sanitizeInfo(info *Info) { type sanitizer map[Type]Type func (s sanitizer) typ(typ Type) Type { + if typ == nil { + return nil + } + if t, found := s[typ]; found { return t } s[typ] = typ switch t := typ.(type) { - case nil, *Basic, *bottom, *top: + case *Basic, *bottom, *top: // nothing to do case *Array: @@ -107,10 +111,14 @@ func (s sanitizer) typ(typ Type) Type { case *Interface: s.funcList(t.methods) - s.typ(t.types) + if types := s.typ(t.types); types != t.types { + t.types = types + } s.typeList(t.embeddeds) s.funcList(t.allMethods) - s.typ(t.allTypes) + if allTypes := s.typ(t.allTypes); allTypes != t.allTypes { + t.allTypes = allTypes + } case *Map: if key := s.typ(t.key); key != t.key {