]> Cypherpunks repositories - gostls13.git/commit
reflect: allow conversions between slices of named {byte,rune} and string
authorKeith Randall <khr@golang.org>
Tue, 27 Jan 2026 19:06:18 +0000 (11:06 -0800)
committerKeith Randall <khr@google.com>
Tue, 27 Jan 2026 23:08:23 +0000 (15:08 -0800)
commita0796d8af67e147f54e06952272745aa3410c291
treef8ff2b8513ade977bad90352d8631020e05d0640
parent481ab86aafe0cac177df793c9946c5ef2126137c
reflect: allow conversions between slices of named {byte,rune} and string

So the reflect behavior matches that of the language.

These conversions are allowed:

[]myByte <-> string
[]myRune <-> string
[]myByte <-> myString
[]myRune <-> myString

And even if the left-hand-side is named, e.g.

myBytes([]myByte) <-> string

Fixes #53523

Change-Id: I6562e72bc233a45dc7b02f75f68020831ad399ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/739680
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/reflect/all_test.go
src/reflect/value.go