aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder/stencil.go
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-03-14 13:46:23 -0700
committerDan Scales <danscales@google.com>2021-03-15 20:29:11 +0000
commit96aecdcb36ad5240a9858f7f7d77ace30f2deaaa (patch)
treecf3c49cf8575bfe24eb7fae5b66220f274e6ba95 /src/cmd/compile/internal/noder/stencil.go
parentc2360956389a30a27407fb857fd4916f20f8dc01 (diff)
downloadgo-96aecdcb36ad5240a9858f7f7d77ace30f2deaaa.tar.xz
cmd/compile: fix case where func-valued field of a generic type is called
Added test example orderedmap.go (binary search tree) that requires this fix (calling function compare in _Map). Also added new tests slices.go and metrics.go that just work. Change-Id: Ifa5f42ab6eee9aa54c40f0eca19e00a87f8f608a Reviewed-on: https://go-review.googlesource.com/c/go/+/301829 Trust: Dan Scales <danscales@google.com> Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/noder/stencil.go')
-rw-r--r--src/cmd/compile/internal/noder/stencil.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go
index 78c7ddeabe..64b3a942e2 100644
--- a/src/cmd/compile/internal/noder/stencil.go
+++ b/src/cmd/compile/internal/noder/stencil.go
@@ -389,6 +389,13 @@ func (subst *subster) node(n ir.Node) ir.Node {
typecheck.Callee(call.X)
call.SetTypecheck(0)
typecheck.Call(call)
+ } else if call.X.Op() == ir.ODOT || call.X.Op() == ir.ODOTPTR {
+ // An OXDOT for a generic receiver was resolved to
+ // an access to a field which has a function
+ // value. Typecheck the call to that function, now
+ // that the OXDOT was resolved.
+ call.SetTypecheck(0)
+ typecheck.Call(call)
} else if call.X.Op() != ir.OFUNCINST {
// A call with an OFUNCINST will get typechecked
// in stencil() once we have created & attached the