From 5137c473b64cb157380eb6deb1b60bf6780402b3 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 16 Oct 2025 16:09:11 -0700 Subject: [PATCH] go/types, types2: remove references to under function in comments Follow-up on CL 712400 which removed the under function. Change-Id: I253c8adbbaa058150f26e311e37b4c1644b6554d Reviewed-on: https://go-review.googlesource.com/c/go/+/712520 Reviewed-by: Mark Freeman Reviewed-by: Robert Griesemer LUCI-TryBot-Result: Go LUCI Auto-Submit: Robert Griesemer --- src/cmd/compile/internal/types2/call.go | 2 +- src/cmd/compile/internal/types2/infer.go | 2 +- src/cmd/compile/internal/types2/lookup.go | 4 ++-- src/cmd/compile/internal/types2/named.go | 4 ++-- src/cmd/compile/internal/types2/predicates.go | 6 +++--- src/cmd/compile/internal/types2/unify.go | 2 +- src/go/types/call.go | 2 +- src/go/types/infer.go | 2 +- src/go/types/lookup.go | 4 ++-- src/go/types/named.go | 4 ++-- src/go/types/predicates.go | 6 +++--- src/go/types/unify.go | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/cmd/compile/internal/types2/call.go b/src/cmd/compile/internal/types2/call.go index aca205ad98..7128ad7866 100644 --- a/src/cmd/compile/internal/types2/call.go +++ b/src/cmd/compile/internal/types2/call.go @@ -57,7 +57,7 @@ func (check *Checker) funcInst(T *target, pos syntax.Pos, x *operand, inst *synt // Check the number of type arguments (got) vs number of type parameters (want). // Note that x is a function value, not a type expression, so we don't need to - // call under below. + // call Underlying below. sig := x.typ.(*Signature) got, want := len(targs), sig.TypeParams().Len() if got > want { diff --git a/src/cmd/compile/internal/types2/infer.go b/src/cmd/compile/internal/types2/infer.go index e7c5959737..996f6a5109 100644 --- a/src/cmd/compile/internal/types2/infer.go +++ b/src/cmd/compile/internal/types2/infer.go @@ -427,7 +427,7 @@ func (check *Checker) infer(pos syntax.Pos, tparams []*TypeParam, targs []Type, // Note that if t0 was a signature, t1 must be a signature, and t1 // can only be a generic signature if it originated from a generic // function argument. Those signatures are never defined types and - // thus there is no need to call under below. + // thus there is no need to call Underlying below. // TODO(gri) Consider doing this in Checker.subst. // Then this would fall out automatically here and also // in instantiation (where we also explicitly nil out diff --git a/src/cmd/compile/internal/types2/lookup.go b/src/cmd/compile/internal/types2/lookup.go index 0b9282e1a7..3e18db09f5 100644 --- a/src/cmd/compile/internal/types2/lookup.go +++ b/src/cmd/compile/internal/types2/lookup.go @@ -145,8 +145,8 @@ func lookupFieldOrMethodImpl(T Type, addressable bool, pkg *Package, name string return // blank fields/methods are never found } - // Importantly, we must not call under before the call to deref below (nor - // does deref call under), as doing so could incorrectly result in finding + // Importantly, we must not call Underlying before the call to deref below (nor + // does deref call Underlying), as doing so could incorrectly result in finding // methods of the pointer base type when T is a (*Named) pointer type. typ, isPtr := deref(T) diff --git a/src/cmd/compile/internal/types2/named.go b/src/cmd/compile/internal/types2/named.go index 4a28929c51..80247e63de 100644 --- a/src/cmd/compile/internal/types2/named.go +++ b/src/cmd/compile/internal/types2/named.go @@ -521,8 +521,8 @@ func (n *Named) Underlying() Type { n.resolve() // The gccimporter depends on writing a nil underlying via NewNamed and - // immediately reading it back. Rather than putting that in under() and - // complicating things there, we just check for that special case here. + // immediately reading it back. Rather than putting that in Named.under + // and complicating things there, we just check for that special case here. if n.fromRHS == nil { assert(n.allowNilRHS) if n.allowNilUnderlying { diff --git a/src/cmd/compile/internal/types2/predicates.go b/src/cmd/compile/internal/types2/predicates.go index 60147c5e21..b0578c2991 100644 --- a/src/cmd/compile/internal/types2/predicates.go +++ b/src/cmd/compile/internal/types2/predicates.go @@ -85,7 +85,7 @@ func isTypeLit(t Type) bool { // Safe to call from types that are not fully set up. func isTyped(t Type) bool { // Alias and named types cannot denote untyped types - // so there's no need to call Unalias or under, below. + // so there's no need to call Unalias or Underlying, below. b, _ := t.(*Basic) return b == nil || b.info&IsUntyped == 0 } @@ -100,7 +100,7 @@ func isUntyped(t Type) bool { // Safe to call from types that are not fully set up. func isUntypedNumeric(t Type) bool { // Alias and named types cannot denote untyped types - // so there's no need to call Unalias or under, below. + // so there's no need to call Unalias or Underlying, below. b, _ := t.(*Basic) return b != nil && b.info&IsUntyped != 0 && b.info&IsNumeric != 0 } @@ -519,7 +519,7 @@ func identicalInstance(xorig Type, xargs []Type, yorig Type, yargs []Type) bool // for untyped nil is untyped nil. func Default(t Type) Type { // Alias and named types cannot denote untyped types - // so there's no need to call Unalias or under, below. + // so there's no need to call Unalias or Underlying, below. if t, _ := t.(*Basic); t != nil { switch t.kind { case UntypedBool: diff --git a/src/cmd/compile/internal/types2/unify.go b/src/cmd/compile/internal/types2/unify.go index eecef455ac..f4f24f4d1b 100644 --- a/src/cmd/compile/internal/types2/unify.go +++ b/src/cmd/compile/internal/types2/unify.go @@ -779,7 +779,7 @@ func (u *unifier) nify(x, y Type, mode unifyMode, p *ifacePair) (result bool) { } // If y is a defined type, it may not match against cx which // is an underlying type (incl. int, string, etc.). Use assign - // mode here so that the unifier automatically takes under(y) + // mode here so that the unifier automatically uses y.Underlying() // if necessary. return u.nify(cx, yorig, assign, p) } diff --git a/src/go/types/call.go b/src/go/types/call.go index 44549b8727..98498763c8 100644 --- a/src/go/types/call.go +++ b/src/go/types/call.go @@ -58,7 +58,7 @@ func (check *Checker) funcInst(T *target, pos token.Pos, x *operand, ix *indexed // Check the number of type arguments (got) vs number of type parameters (want). // Note that x is a function value, not a type expression, so we don't need to - // call under below. + // call Underlying below. sig := x.typ.(*Signature) got, want := len(targs), sig.TypeParams().Len() if got > want { diff --git a/src/go/types/infer.go b/src/go/types/infer.go index a8da7ac674..25a26b38a5 100644 --- a/src/go/types/infer.go +++ b/src/go/types/infer.go @@ -430,7 +430,7 @@ func (check *Checker) infer(posn positioner, tparams []*TypeParam, targs []Type, // Note that if t0 was a signature, t1 must be a signature, and t1 // can only be a generic signature if it originated from a generic // function argument. Those signatures are never defined types and - // thus there is no need to call under below. + // thus there is no need to call Underlying below. // TODO(gri) Consider doing this in Checker.subst. // Then this would fall out automatically here and also // in instantiation (where we also explicitly nil out diff --git a/src/go/types/lookup.go b/src/go/types/lookup.go index c479303a35..97debb7395 100644 --- a/src/go/types/lookup.go +++ b/src/go/types/lookup.go @@ -148,8 +148,8 @@ func lookupFieldOrMethodImpl(T Type, addressable bool, pkg *Package, name string return // blank fields/methods are never found } - // Importantly, we must not call under before the call to deref below (nor - // does deref call under), as doing so could incorrectly result in finding + // Importantly, we must not call Underlying before the call to deref below (nor + // does deref call Underlying), as doing so could incorrectly result in finding // methods of the pointer base type when T is a (*Named) pointer type. typ, isPtr := deref(T) diff --git a/src/go/types/named.go b/src/go/types/named.go index d7e4c24796..faa7bc2a70 100644 --- a/src/go/types/named.go +++ b/src/go/types/named.go @@ -524,8 +524,8 @@ func (n *Named) Underlying() Type { n.resolve() // The gccimporter depends on writing a nil underlying via NewNamed and - // immediately reading it back. Rather than putting that in under() and - // complicating things there, we just check for that special case here. + // immediately reading it back. Rather than putting that in Named.under + // and complicating things there, we just check for that special case here. if n.fromRHS == nil { assert(n.allowNilRHS) if n.allowNilUnderlying { diff --git a/src/go/types/predicates.go b/src/go/types/predicates.go index ad929db266..7a48c2c96c 100644 --- a/src/go/types/predicates.go +++ b/src/go/types/predicates.go @@ -88,7 +88,7 @@ func isTypeLit(t Type) bool { // Safe to call from types that are not fully set up. func isTyped(t Type) bool { // Alias and named types cannot denote untyped types - // so there's no need to call Unalias or under, below. + // so there's no need to call Unalias or Underlying, below. b, _ := t.(*Basic) return b == nil || b.info&IsUntyped == 0 } @@ -103,7 +103,7 @@ func isUntyped(t Type) bool { // Safe to call from types that are not fully set up. func isUntypedNumeric(t Type) bool { // Alias and named types cannot denote untyped types - // so there's no need to call Unalias or under, below. + // so there's no need to call Unalias or Underlying, below. b, _ := t.(*Basic) return b != nil && b.info&IsUntyped != 0 && b.info&IsNumeric != 0 } @@ -522,7 +522,7 @@ func identicalInstance(xorig Type, xargs []Type, yorig Type, yargs []Type) bool // for untyped nil is untyped nil. func Default(t Type) Type { // Alias and named types cannot denote untyped types - // so there's no need to call Unalias or under, below. + // so there's no need to call Unalias or Underlying, below. if t, _ := t.(*Basic); t != nil { switch t.kind { case UntypedBool: diff --git a/src/go/types/unify.go b/src/go/types/unify.go index ea96de82f0..3b52e6e1e6 100644 --- a/src/go/types/unify.go +++ b/src/go/types/unify.go @@ -782,7 +782,7 @@ func (u *unifier) nify(x, y Type, mode unifyMode, p *ifacePair) (result bool) { } // If y is a defined type, it may not match against cx which // is an underlying type (incl. int, string, etc.). Use assign - // mode here so that the unifier automatically takes under(y) + // mode here so that the unifier automatically uses y.Underlying() // if necessary. return u.nify(cx, yorig, assign, p) }