From 0cf71f7f92c2623a132ab3257690826643d548af Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Fri, 25 Jun 2021 22:24:29 +0700 Subject: [dev.typeparams] cmd/compile: rewrite method calls during typecheck CL 330671 move rewriting method call to method expression to escape analysis. This CL move the rewriting up further, into typecheck. It helps simplify the code for dowstream passes, as they now only have to deal with OCALLFUNC. There're two notes: - For -G=3, we can't rewrite d.M() where d is an instantiated receiver in transformCall, but let irgen.stencil to rewrite it. - Escape analysis still have to check for rewriting method calls, as the devirtualization pass can still generate OCALLMETH. Does not pass toolstash, since when the export data now contains method expression calls instead of method calls. Change-Id: I77465ef04d50dc4efedddca7eb55b3fc9483db0e Reviewed-on: https://go-review.googlesource.com/c/go/+/330831 Trust: Cuong Manh Le Run-TryBot: Cuong Manh Le TryBot-Result: Go Bot Reviewed-by: Matthew Dempsky --- src/cmd/compile/internal/noder/reader.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/cmd/compile/internal/noder/reader.go') diff --git a/src/cmd/compile/internal/noder/reader.go b/src/cmd/compile/internal/noder/reader.go index 459e1d1703..e5ad3f4b8e 100644 --- a/src/cmd/compile/internal/noder/reader.go +++ b/src/cmd/compile/internal/noder/reader.go @@ -1807,8 +1807,7 @@ func InlineCall(call *ir.CallExpr, fn *ir.Func, inlIndex int) *ir.InlinedCallExp var args ir.Nodes if call.Op() == ir.OCALLMETH { - assert(call.X.Op() == ir.ODOTMETH) - args.Append(call.X.(*ir.SelectorExpr).X) + base.FatalfAt(call.Pos(), "OCALLMETH missed by typecheck") } args.Append(call.Args...) -- cgit v1.2.3-54-g00ecf