mirror of
https://github.com/golang/go.git
synced 2025-10-19 19:13:18 +00:00
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:
parent
dbbb1bfc91
commit
5137c473b6
12 changed files with 20 additions and 20 deletions
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue