]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix wrong typeparams for selector expr with embedded generic type
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Sat, 23 Jul 2022 15:31:35 +0000 (22:31 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 11 Aug 2022 19:05:54 +0000 (19:05 +0000)
commit62654dfd4f8d7ac2309232dc3c09c33b1741ce95
tree68ff8259ce7430de789dda13036c8205c1ea93c0
parent9e4638ad20181ba4c3b1985da48c56be121901fb
cmd/compile: fix wrong typeparams for selector expr with embedded generic type

For selector expression "x.M" where "M" is a promoted method, irgen is using
the type of receiver "x" for determining the typeparams for instantiation.
However, because M is a promoted method, so its associated receiver is
not "x", but "x.T" where "T" is the embedded field of "x". That casues a
mismatch when converting non-shape types arguments.

Fixing it by using the actual receiver which has the method, instead of
using the base receiver.

Fixes #53982

Change-Id: I1836fc422d734df14e9e6664d4bd014503960bfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/419294
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
src/cmd/compile/internal/noder/stencil.go
test/fixedbugs/issue53982.go [new file with mode: 0644]