}
// "V and T are both integer or floating point types"
- if isIntegerOrFloat(V) && isIntegerOrFloat(T) {
+ if isIntegerOrFloat(Vu) && isIntegerOrFloat(Tu) {
return true
}
// "V and T are both complex types"
- if isComplex(V) && isComplex(T) {
+ if isComplex(Vu) && isComplex(Tu) {
return true
}
// "V is an integer or a slice of bytes or runes and T is a string type"
- if (isInteger(V) || isBytesOrRunes(Vu)) && isString(T) {
+ if (isInteger(Vu) || isBytesOrRunes(Vu)) && isString(Tu) {
return true
}
// "V is a string and T is a slice of bytes or runes"
- if isString(V) && isBytesOrRunes(Tu) {
+ if isString(Vu) && isBytesOrRunes(Tu) {
return true
}
// package unsafe:
// "any pointer or value of underlying type uintptr can be converted into a unsafe.Pointer"
- if (isPointer(Vu) || isUintptr(Vu)) && isUnsafePointer(T) {
+ if (isPointer(Vu) || isUintptr(Vu)) && isUnsafePointer(Tu) {
return true
}
// "and vice versa"
- if isUnsafePointer(V) && (isPointer(Tu) || isUintptr(Tu)) {
+ if isUnsafePointer(Vu) && (isPointer(Tu) || isUintptr(Tu)) {
return true
}
// "V a slice, T is a pointer-to-array type,
// and the slice and array types have identical element types."
- if s, _ := under(V).(*Slice); s != nil {
- if p, _ := under(T).(*Pointer); p != nil {
+ if s, _ := Vu.(*Slice); s != nil {
+ if p, _ := Tu.(*Pointer); p != nil {
if a, _ := under(p.Elem()).(*Array); a != nil {
if Identical(s.Elem(), a.Elem()) {
if check == nil || check.allowVersion(check.pkg, 1, 17) {
return false
}
-// Helper predicates for convertibleToImpl. The types provided to convertibleToImpl
-// may be type parameters but they won't have specific type terms. Thus it is ok to
-// use the toT convenience converters in the predicates below.
-
func isUintptr(typ Type) bool {
t, _ := under(typ).(*Basic)
return t != nil && t.kind == Uintptr
}
func isUnsafePointer(typ Type) bool {
- // TODO(gri): Is this under(typ).(*Basic) instead of typ.(*Basic) correct?
- // (The former calls under(), while the latter doesn't.)
- // The spec does not say so, but gc claims it is. See also
- // issue 6326.
t, _ := under(typ).(*Basic)
return t != nil && t.kind == UnsafePointer
}