mirror of https://github.com/golang/go.git
reflect: panic on Invalid Interface call
This was initially pushed as part of CL 4876046, found when logic in exp/template was using the method on an Invalid value. R=rsc CC=golang-dev https://golang.org/cl/4890043
This commit is contained in:
parent
241a262fe5
commit
a2bb0159d6
|
|
@ -860,6 +860,9 @@ func (v Value) Interface() interface{} {
|
|||
}
|
||||
|
||||
func (iv internalValue) Interface() interface{} {
|
||||
if iv.kind == 0 {
|
||||
panic(&ValueError{"reflect.Value.Interface", iv.kind})
|
||||
}
|
||||
if iv.method {
|
||||
panic("reflect.Value.Interface: cannot create interface value for method with bound receiver")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue