Use typecheck.Conv; it does the same thing.
Change-Id: I6bf27b8e929f8016ffc8350931c8320e36584a3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/354350
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
r := ir.NewCallExpr(base.Pos, ir.OCALL, on, nil)
if params := on.Type().Params().FieldSlice(); len(params) > 0 {
t := params[0].Type
- if !types.Identical(t, n.Type()) {
- n = ir.NewConvExpr(base.Pos, ir.OCONV, nil, n)
- n.SetType(t)
- }
+ n = typecheck.Conv(n, t)
r.Args.Append(n)
}
calls = append(calls, r)