mirror of
https://github.com/golang/go
synced 2024-11-11 22:20:22 -07:00
cmd/compile/internal/types2: fix potential bugs in santitizer pass
Change-Id: I88c5e1f620d0f3546ac9ac7b6a4b881772a38449 Reviewed-on: https://go-review.googlesource.com/c/go/+/317329 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
784ef4c531
commit
40d5e6d4e2
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user