Commit a2bb0159 authored by Gustavo Niemeyer's avatar Gustavo Niemeyer

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
parent 241a262f
......@@ -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")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment