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 <markfreeman@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
This commit is contained in:
Robert Griesemer 2025-10-16 16:09:11 -07:00 committed by Gopher Robot
parent dbbb1bfc91
commit 5137c473b6
12 changed files with 20 additions and 20 deletions

View file

@ -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). // 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 // 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) sig := x.typ.(*Signature)
got, want := len(targs), sig.TypeParams().Len() got, want := len(targs), sig.TypeParams().Len()
if got > want { if got > want {

View file

@ -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 // 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 // can only be a generic signature if it originated from a generic
// function argument. Those signatures are never defined types and // 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. // TODO(gri) Consider doing this in Checker.subst.
// Then this would fall out automatically here and also // Then this would fall out automatically here and also
// in instantiation (where we also explicitly nil out // in instantiation (where we also explicitly nil out

View file

@ -145,8 +145,8 @@ func lookupFieldOrMethodImpl(T Type, addressable bool, pkg *Package, name string
return // blank fields/methods are never found return // blank fields/methods are never found
} }
// Importantly, we must not call under before the call to deref below (nor // Importantly, we must not call Underlying before the call to deref below (nor
// does deref call under), as doing so could incorrectly result in finding // 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. // methods of the pointer base type when T is a (*Named) pointer type.
typ, isPtr := deref(T) typ, isPtr := deref(T)

View file

@ -521,8 +521,8 @@ func (n *Named) Underlying() Type {
n.resolve() n.resolve()
// The gccimporter depends on writing a nil underlying via NewNamed and // The gccimporter depends on writing a nil underlying via NewNamed and
// immediately reading it back. Rather than putting that in under() and // immediately reading it back. Rather than putting that in Named.under
// complicating things there, we just check for that special case here. // and complicating things there, we just check for that special case here.
if n.fromRHS == nil { if n.fromRHS == nil {
assert(n.allowNilRHS) assert(n.allowNilRHS)
if n.allowNilUnderlying { if n.allowNilUnderlying {

View file

@ -85,7 +85,7 @@ func isTypeLit(t Type) bool {
// Safe to call from types that are not fully set up. // Safe to call from types that are not fully set up.
func isTyped(t Type) bool { func isTyped(t Type) bool {
// Alias and named types cannot denote untyped types // 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) b, _ := t.(*Basic)
return b == nil || b.info&IsUntyped == 0 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. // Safe to call from types that are not fully set up.
func isUntypedNumeric(t Type) bool { func isUntypedNumeric(t Type) bool {
// Alias and named types cannot denote untyped types // 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) b, _ := t.(*Basic)
return b != nil && b.info&IsUntyped != 0 && b.info&IsNumeric != 0 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. // for untyped nil is untyped nil.
func Default(t Type) Type { func Default(t Type) Type {
// Alias and named types cannot denote untyped types // 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 { if t, _ := t.(*Basic); t != nil {
switch t.kind { switch t.kind {
case UntypedBool: case UntypedBool:

View file

@ -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 // If y is a defined type, it may not match against cx which
// is an underlying type (incl. int, string, etc.). Use assign // 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. // if necessary.
return u.nify(cx, yorig, assign, p) return u.nify(cx, yorig, assign, p)
} }

View file

@ -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). // 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 // 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) sig := x.typ.(*Signature)
got, want := len(targs), sig.TypeParams().Len() got, want := len(targs), sig.TypeParams().Len()
if got > want { if got > want {

View file

@ -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 // 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 // can only be a generic signature if it originated from a generic
// function argument. Those signatures are never defined types and // 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. // TODO(gri) Consider doing this in Checker.subst.
// Then this would fall out automatically here and also // Then this would fall out automatically here and also
// in instantiation (where we also explicitly nil out // in instantiation (where we also explicitly nil out

View file

@ -148,8 +148,8 @@ func lookupFieldOrMethodImpl(T Type, addressable bool, pkg *Package, name string
return // blank fields/methods are never found return // blank fields/methods are never found
} }
// Importantly, we must not call under before the call to deref below (nor // Importantly, we must not call Underlying before the call to deref below (nor
// does deref call under), as doing so could incorrectly result in finding // 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. // methods of the pointer base type when T is a (*Named) pointer type.
typ, isPtr := deref(T) typ, isPtr := deref(T)

View file

@ -524,8 +524,8 @@ func (n *Named) Underlying() Type {
n.resolve() n.resolve()
// The gccimporter depends on writing a nil underlying via NewNamed and // The gccimporter depends on writing a nil underlying via NewNamed and
// immediately reading it back. Rather than putting that in under() and // immediately reading it back. Rather than putting that in Named.under
// complicating things there, we just check for that special case here. // and complicating things there, we just check for that special case here.
if n.fromRHS == nil { if n.fromRHS == nil {
assert(n.allowNilRHS) assert(n.allowNilRHS)
if n.allowNilUnderlying { if n.allowNilUnderlying {

View file

@ -88,7 +88,7 @@ func isTypeLit(t Type) bool {
// Safe to call from types that are not fully set up. // Safe to call from types that are not fully set up.
func isTyped(t Type) bool { func isTyped(t Type) bool {
// Alias and named types cannot denote untyped types // 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) b, _ := t.(*Basic)
return b == nil || b.info&IsUntyped == 0 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. // Safe to call from types that are not fully set up.
func isUntypedNumeric(t Type) bool { func isUntypedNumeric(t Type) bool {
// Alias and named types cannot denote untyped types // 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) b, _ := t.(*Basic)
return b != nil && b.info&IsUntyped != 0 && b.info&IsNumeric != 0 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. // for untyped nil is untyped nil.
func Default(t Type) Type { func Default(t Type) Type {
// Alias and named types cannot denote untyped types // 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 { if t, _ := t.(*Basic); t != nil {
switch t.kind { switch t.kind {
case UntypedBool: case UntypedBool:

View file

@ -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 // If y is a defined type, it may not match against cx which
// is an underlying type (incl. int, string, etc.). Use assign // 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. // if necessary.
return u.nify(cx, yorig, assign, p) return u.nify(cx, yorig, assign, p)
} }