]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.24] 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:53:54 +0000 (09:53 -0800)
commit5ffdb9c88bd0c79ed2d339548d9c7e09bb3fbf30
tree1da164bc15be5f2c1f5479a920073e76e7ae7d3f
parentbecc17ebcd841da12d4d17fac77312085e244cde
[release-branch.go1.24] 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 #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 d93f6df0cc4f33127ef76fa994edd54d7726d0a9)
Reviewed-on: https://go-review.googlesource.com/c/go/+/651515
src/reflect/iter.go
src/reflect/iter_test.go
src/reflect/value.go