mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: use same conversion panic in reflect and runtime
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>
This commit is contained in:
parent
6bbb0a9d4a
commit
0fd20ed5b6
2 changed files with 2 additions and 2 deletions
|
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue