-
Notifications
You must be signed in to change notification settings - Fork 18k
reflect: Value.Seq panicking on functional iterator methods #71874
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
Comments
Indeed, this looks like a real issue. Oddly enough, writing the CC @golang/runtime |
I see, there's actually special logic for obtaining the type of a value that is a method value, I think. (See the implementation of |
@gopherbot Please open backport issues for Go 1.23 and Go 1.24. |
Backport issue(s) opened: #71875 (for 1.23), #71876 (for 1.24). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Change https://go.dev/cl/651416 mentions this issue: |
Change https://go.dev/cl/651515 mentions this issue: |
Change https://go.dev/cl/651498 mentions this issue: |
…q, CanSeq2} For golang#71874. Change-Id: Idc834fdd9ade41ba4976ded32e5861a2dcef44bf
Change https://go.dev/cl/651775 mentions this issue: |
…,CanSeq2} For golang#71874. Change-Id: Idc834fdd9ade41ba4976ded32e5861a2dcef44bf
Currently method values aren't correctly handled in Seq because we call canRangeFunc on the reciever type, not the method value type, when we're handling a method value. reflect.Value.Type has the logic to obtain the method value type from the Value. This change slightly refactors reflect.Value.Type into a separate function so we can obtain the correct type as an abi.Type and pass it off to canRangeFunc (and canRangeFunc2). For #71874. Fixes #71875. Change-Id: Ie62dfca2a84b8f2f816bb87ff1ed1a58a7bb8122 Reviewed-on: https://go-review.googlesource.com/c/go/+/651416 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> (cherry picked from commit d93f6df) Reviewed-on: https://go-review.googlesource.com/c/go/+/651498 Reviewed-by: Firuze Sayan <sayanfiruze@gmail.com>
Currently method values aren't correctly handled in Seq because we call canRangeFunc on the reciever type, not the method value type, when we're handling a method value. reflect.Value.Type has the logic to obtain the method value type from the Value. This change slightly refactors reflect.Value.Type into a separate function so we can obtain the correct type as an abi.Type and pass it off to canRangeFunc (and canRangeFunc2). For #71874. Fixes #71876. Change-Id: Ie62dfca2a84b8f2f816bb87ff1ed1a58a7bb8122 Reviewed-on: https://go-review.googlesource.com/c/go/+/651416 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> (cherry picked from commit d93f6df) Reviewed-on: https://go-review.googlesource.com/c/go/+/651515
…,CanSeq2} For golang#71874. Change-Id: Idc834fdd9ade41ba4976ded32e5861a2dcef44bf
For #71874. Change-Id: I3850edfb3104305f3bf4847a73cdd826cc99837f GitHub-Last-Rev: 574c1ed GitHub-Pull-Request: #71890 Reviewed-on: https://go-review.googlesource.com/c/go/+/651775 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Go version
go version go1.24.0 darwin/amd64
Output of
go env
in your module/workspace:What did you do?
Tried to call
Seq()
on areflect.Value
containing a func derived from a method with signaturefunc(func(int)bool)
. See this playground code.What did you see happen?
A panic:
What did you expect to see?
No panic.
The text was updated successfully, but these errors were encountered: