Skip to content

Commit 525a5c3

Browse files
reflect: let documentation for Value. Seq and Value.Seq2 clearer
Change-Id: If0bc636942ff93f17a2150152b0918c51548d98a
1 parent 524a774 commit 525a5c3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/reflect/iter.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package reflect
66

77
import "iter"
88

9-
// Seq returns an iter.Seq[reflect.Value] that loops over the elements of v.
9+
// Seq returns an iter.Seq[Value] that loops over the elements of v.
1010
// If v's kind is Func, it must be a function that has no results and
1111
// that takes a single argument of type func(T) bool for some type T.
1212
// If v's kind is Pointer, the pointer element type must have kind Array.
@@ -87,7 +87,11 @@ func (v Value) Seq() iter.Seq[Value] {
8787
panic("reflect: " + v.Type().String() + " cannot produce iter.Seq[Value]")
8888
}
8989

90-
// Seq2 is like Seq but for two values.
90+
// Seq2 returns an iter.Seq2[Value, Value] that loops over the elements of v.
91+
// If v's kind is Func, it must be a function that has no results and
92+
// that takes a single argument of type func(K, V) bool for some type K, V.
93+
// If v's kind is Pointer, the pointer element type must have kind Array.
94+
// Otherwise v's kind must be Array, Map, Slice, or String.
9195
func (v Value) Seq2() iter.Seq2[Value, Value] {
9296
if canRangeFunc2(v.typ()) {
9397
return func(yield func(Value, Value) bool) {

0 commit comments

Comments
 (0)