aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2011-07-18 11:34:13 +1000
committerRob Pike <r@golang.org>2011-07-18 11:34:13 +1000
commit50d90451ff9eb9fc74b52cbf02518164d57f93ed (patch)
tree875a279e446d65fe0c5d6bb5254422389ea16fc8
parent9d55c282e3aac4c2d97590785d7a821adcf8ac9e (diff)
downloadgo-50d90451ff9eb9fc74b52cbf02518164d57f93ed.tar.gz
go-50d90451ff9eb9fc74b52cbf02518164d57f93ed.zip
reflect: panic if Method index is out of range for a type.
Makes the code agree with the documentation. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/4759050
-rw-r--r--src/pkg/reflect/type.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/reflect/type.go b/src/pkg/reflect/type.go
index 76a65effcd..28d94eb408 100644
--- a/src/pkg/reflect/type.go
+++ b/src/pkg/reflect/type.go
@@ -446,7 +446,7 @@ func (t *commonType) common() *commonType { return t }
func (t *uncommonType) Method(i int) (m Method) {
if t == nil || i < 0 || i >= len(t.methods) {
- return
+ panic("reflect: Method index out of range")
}
p := &t.methods[i]
if p.name != nil {
@@ -904,7 +904,7 @@ func toCommonType(p *runtime.Type) *commonType {
}
x := unsafe.Pointer(p)
if uintptr(x)&reflectFlags != 0 {
- panic("invalid interface value")
+ panic("reflect: invalid interface value")
}
return &(*hdr)(x).t
}