]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: use same conversion panic in reflect and runtime
authorIan Lance Taylor <iant@golang.org>
Mon, 14 Jun 2021 21:30:46 +0000 (14:30 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 14 Jun 2021 21:46:05 +0000 (21:46 +0000)
Consistently say "pointer to array", not "array pointer".

Fixes #46743

Change-Id: I2388ec5c16f96e82a3a383b9b462b350686ddc5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/327870
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/reflect/all_test.go
src/reflect/value.go

index 17104ad4fabe5718f0728a738bd0965dc20b0e9b..0db5e132172fd9917028cd924dd24e068727eab3 100644 (file)
@@ -4371,7 +4371,7 @@ func TestConvertPanic(t *testing.T) {
        if !v.Type().ConvertibleTo(pt) {
                t.Errorf("[]byte should be convertible to *[8]byte")
        }
-       shouldPanic("reflect: cannot convert slice with length 4 to array pointer with length 8", func() {
+       shouldPanic("reflect: cannot convert slice with length 4 to pointer to array with length 8", func() {
                _ = v.Convert(pt)
        })
 }
index c963a407bcc80cce6c8b324a30f212be5b4d6d22..6ba6202a1a1b1b1470a5d6842dec6dabb0ce8f26 100644 (file)
@@ -3067,7 +3067,7 @@ func cvtSliceArrayPtr(v Value, t Type) Value {
        n := t.Elem().Len()
        h := (*unsafeheader.Slice)(v.ptr)
        if n > h.Len {
-               panic("reflect: cannot convert slice with length " + itoa.Itoa(h.Len) + " to array pointer with length " + itoa.Itoa(n))
+               panic("reflect: cannot convert slice with length " + itoa.Itoa(h.Len) + " to pointer to array with length " + itoa.Itoa(n))
        }
        return Value{t.common(), h.Data, v.flag&^(flagIndir|flagAddr|flagKindMask) | flag(Ptr)}
 }