]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.23] reflect: correctly handle method values in Seq
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 21 Feb 2025 15:53:51 +0000 (15:53 +0000)
committerMichael Pratt <mpratt@google.com>
Wed, 26 Feb 2025 17:54:04 +0000 (09:54 -0800)
commitd89fda21d5fca4f19a3f70f4c0131dde63157a3e
tree85952de17fef79f986214417b5e6b2c966cdebf5
parentacde84cf1b7b90bb7b3eb03b62efdda643a78f97
[release-branch.go1.23] reflect: correctly handle method values in Seq

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 d93f6df0cc4f33127ef76fa994edd54d7726d0a9)
Reviewed-on: https://go-review.googlesource.com/c/go/+/651498
Reviewed-by: Firuze Sayan <sayanfiruze@gmail.com>
src/reflect/iter.go
src/reflect/iter_test.go
src/reflect/value.go