diff options
Diffstat (limited to 'src/cmd/compile/internal/noder/stencil.go')
-rw-r--r-- | src/cmd/compile/internal/noder/stencil.go | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go index 602e88c102..b3ff4b8855 100644 --- a/src/cmd/compile/internal/noder/stencil.go +++ b/src/cmd/compile/internal/noder/stencil.go @@ -732,21 +732,15 @@ func (g *irgen) genericSubst(newsym *types.Sym, nameNode *ir.Name, shapes []*typ g.instTypeList = append(g.instTypeList, subst.ts.InstTypeList...) if doubleCheck { - okConvs := map[ir.Node]bool{} ir.Visit(newf, func(n ir.Node) { - if n.Op() == ir.OIDATA { - // IDATA(OCONVIFACE(x)) is ok, as we don't use the type of x. - // TODO: use some other op besides OCONVIFACE. ONEW might work - // (with appropriate direct vs. indirect interface cases). - okConvs[n.(*ir.UnaryExpr).X] = true + if n.Op() != ir.OCONVIFACE { + return } - if n.Op() == ir.OCONVIFACE && !okConvs[n] { - c := n.(*ir.ConvExpr) - if c.X.Type().HasShape() { - ir.Dump("BAD FUNCTION", newf) - ir.Dump("BAD CONVERSION", c) - base.Fatalf("converting shape type to interface") - } + c := n.(*ir.ConvExpr) + if c.X.Type().HasShape() { + ir.Dump("BAD FUNCTION", newf) + ir.Dump("BAD CONVERSION", c) + base.Fatalf("converting shape type to interface") } }) } @@ -1054,6 +1048,13 @@ func (subst *subster) node(n ir.Node) ir.Node { case ir.OCLOSURE: transformCall(call) + case ir.ODEREF, ir.OINDEX, ir.OINDEXMAP, ir.ORECV: + // Transform a call that was delayed because of the + // use of typeparam inside an expression that required + // a pointer dereference, array indexing, map indexing, + // or channel receive to compute function value. + transformCall(call) + case ir.OFUNCINST: // A call with an OFUNCINST will get transformed // in stencil() once we have created & attached the |