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>
// 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 {
// 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
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)
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 {
// 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
}
// 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
}
// 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:
}
// 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)
}
// 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 {
// 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
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)
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 {
// 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
}
// 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
}
// 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:
}
// 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)
}