aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorMark Freeman <mark@golang.org>2026-04-01 15:45:17 -0400
committerMark Freeman <mark@golang.org>2026-04-03 10:10:16 -0700
commitb9c77f8c00b09d3d17e603fa576e0148e501bd70 (patch)
treedfa63012cd4c06c1d2eb19b3507caaf520cb2574 /test/codegen
parentae1edbeb2f77c8242ab7adf57b2449ae4740544d (diff)
downloadgo-b9c77f8c00b09d3d17e603fa576e0148e501bd70.tar.xz
cmd/compile/internal/noder: offset type parameter indices
When a writer goes to encode use of a type parameter, it only records an index because the writer knows all of the type parameters in scope for that object. The writer orders the type parameteres as implicits first, then receivers, then explicits actually on the object. Note that receivers *are* explicit type arguments, they're just inherited from the type. For instance, given: func (T[P]) m[Q, R any]() This has: - 0 implicits - 1 receiver - 2 explicits With this ordering, P is at 0, Q is at 1, and R is at 2. In contrast, inspecting TypeParam.index for Q yields 0, and for R yields 1; hence the offset is needed. Change-Id: If12f342e109fbc5935ba278f574ac2809c889335 Reviewed-on: https://go-review.googlesource.com/c/go/+/762021 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'test/codegen')
0 files changed, 0 insertions, 0 deletions