aboutsummaryrefslogtreecommitdiff
path: root/src/internal/reflectlite/value.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/reflectlite/value.go')
-rw-r--r--src/internal/reflectlite/value.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/internal/reflectlite/value.go b/src/internal/reflectlite/value.go
index 85beea606c..fb0ec77b58 100644
--- a/src/internal/reflectlite/value.go
+++ b/src/internal/reflectlite/value.go
@@ -160,7 +160,10 @@ type ValueError struct {
}
func (e *ValueError) Error() string {
- return "reflect: call of " + e.Method + " on zero Value"
+ if e.Kind == 0 {
+ return "reflect: call of " + e.Method + " on zero Value"
+ }
+ return "reflect: call of " + e.Method + " on " + e.Kind.String() + " Value"
}
// methodName returns the name of the calling method,
@@ -225,7 +228,7 @@ func (v Value) Elem() Value {
switch k {
case Interface:
var eface interface{}
- if v.typ.NumMethod() == 0 {
+ if isEmptyIface(v.typ) {
eface = *(*interface{})(v.ptr)
} else {
eface = (interface{})(*(*interface {
@@ -430,7 +433,7 @@ func (v Value) assignTo(context string, dst *rtype, target unsafe.Pointer) Value
return Value{dst, nil, flag(Interface)}
}
x := valueInterface(v)
- if dst.NumMethod() == 0 {
+ if isEmptyIface(dst) {
*(*interface{})(target) = x
} else {
ifaceE2I(dst, x, target)