Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reflect: verify/ensure that reflect supports the same string/[]byte/[]rune conversions as the spec/implementation #53523

griesemer opened this issue Jun 23, 2022 · 2 comments
compiler/runtime NeedsInvestigation


Copy link

@griesemer griesemer commented Jun 23, 2022

Follow-up on #23814.
See for examples.

@griesemer griesemer added the NeedsInvestigation label Jun 23, 2022
@griesemer griesemer added this to the Go1.20 milestone Jun 23, 2022
Copy link

@dsnet dsnet commented Jun 24, 2022

See #24746 where it is observed that reflect lets you do:

type namedByte byte
var b []namedByte
reflect.ValueOf(b).Bytes() // analogous to []byte(b), which is invalid according to the Go spec

Copy link
Contributor Author

@griesemer griesemer commented Jun 24, 2022

@dsnet That conversion is a slice-to-slice conversion which always required that element types be identical (playground); this seems a bit different from the string->bytes/runes and bytes/runes->string conversions, which are special.

That is, I'd argue that reflect is incorrect in that case.

@gopherbot gopherbot added the compiler/runtime label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
compiler/runtime NeedsInvestigation
Status: Triage Backlog

No branches or pull requests

3 participants