Skip to content

Commit 3ab2909

Browse files
kolyshkingopherbot
authored andcommitted
go/ssa: remove unused func
This function was used by wellFormed, which was removed in CL 581835, so it is of no use now. Remove it. Updates golang/go#66783 Change-Id: I9b286238e2db93b364cef0dcdead397c4741c15e Reviewed-on: https://go-review.googlesource.com/c/tools/+/703035 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Kirill Kolyshkin <kolyshkin@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent 224e336 commit 3ab2909

File tree

1 file changed

+0
-73
lines changed

1 file changed

+0
-73
lines changed

go/ssa/subst.go

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -567,76 +567,3 @@ func (subst *subster) signature(t *types.Signature) types.Type {
567567
}
568568
return t
569569
}
570-
571-
// reaches returns true if a type t reaches any type t' s.t. c[t'] == true.
572-
// It updates c to cache results.
573-
//
574-
// reaches is currently only part of the wellFormed debug logic, and
575-
// in practice c is initially only type parameters. It is not currently
576-
// relied on in production.
577-
func reaches(t types.Type, c map[types.Type]bool) (res bool) {
578-
if c, ok := c[t]; ok {
579-
return c
580-
}
581-
582-
// c is populated with temporary false entries as types are visited.
583-
// This avoids repeat visits and break cycles.
584-
c[t] = false
585-
defer func() {
586-
c[t] = res
587-
}()
588-
589-
switch t := t.(type) {
590-
case *types.TypeParam, *types.Basic:
591-
return false
592-
case *types.Array:
593-
return reaches(t.Elem(), c)
594-
case *types.Slice:
595-
return reaches(t.Elem(), c)
596-
case *types.Pointer:
597-
return reaches(t.Elem(), c)
598-
case *types.Tuple:
599-
for i := 0; i < t.Len(); i++ {
600-
if reaches(t.At(i).Type(), c) {
601-
return true
602-
}
603-
}
604-
case *types.Struct:
605-
for i := 0; i < t.NumFields(); i++ {
606-
if reaches(t.Field(i).Type(), c) {
607-
return true
608-
}
609-
}
610-
case *types.Map:
611-
return reaches(t.Key(), c) || reaches(t.Elem(), c)
612-
case *types.Chan:
613-
return reaches(t.Elem(), c)
614-
case *types.Signature:
615-
if t.Recv() != nil && reaches(t.Recv().Type(), c) {
616-
return true
617-
}
618-
return reaches(t.Params(), c) || reaches(t.Results(), c)
619-
case *types.Union:
620-
for i := 0; i < t.Len(); i++ {
621-
if reaches(t.Term(i).Type(), c) {
622-
return true
623-
}
624-
}
625-
case *types.Interface:
626-
for i := 0; i < t.NumEmbeddeds(); i++ {
627-
if reaches(t.Embedded(i), c) {
628-
return true
629-
}
630-
}
631-
for i := 0; i < t.NumExplicitMethods(); i++ {
632-
if reaches(t.ExplicitMethod(i).Type(), c) {
633-
return true
634-
}
635-
}
636-
case *types.Named, *types.Alias:
637-
return reaches(t.Underlying(), c)
638-
default:
639-
panic("unreachable")
640-
}
641-
return false
642-
}

0 commit comments

Comments
 (0)