Skip to content

Commit 5d863f8

Browse files
committed
cmd/compile: simplify bad conversion check
Now that we're using OCONVIDATA(x) everywhere we formerly used OIDATA(OCONVIFACE(x)), there should be no OCONVIFACE operations that take a shape type. Change-Id: I4fb056456c60481c6dfe7bc111fca6223567e6a8 Reviewed-on: https://go-review.googlesource.com/c/go/+/344577 Trust: Keith Randall <[email protected]> Trust: Dan Scales <[email protected]> Run-TryBot: Keith Randall <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Dan Scales <[email protected]>
1 parent c2f96e6 commit 5d863f8

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

src/cmd/compile/internal/noder/stencil.go

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -732,21 +732,15 @@ func (g *irgen) genericSubst(newsym *types.Sym, nameNode *ir.Name, shapes []*typ
732732
g.instTypeList = append(g.instTypeList, subst.ts.InstTypeList...)
733733

734734
if doubleCheck {
735-
okConvs := map[ir.Node]bool{}
736735
ir.Visit(newf, func(n ir.Node) {
737-
if n.Op() == ir.OIDATA {
738-
// IDATA(OCONVIFACE(x)) is ok, as we don't use the type of x.
739-
// TODO: use some other op besides OCONVIFACE. ONEW might work
740-
// (with appropriate direct vs. indirect interface cases).
741-
okConvs[n.(*ir.UnaryExpr).X] = true
736+
if n.Op() != ir.OCONVIFACE {
737+
return
742738
}
743-
if n.Op() == ir.OCONVIFACE && !okConvs[n] {
744-
c := n.(*ir.ConvExpr)
745-
if c.X.Type().HasShape() {
746-
ir.Dump("BAD FUNCTION", newf)
747-
ir.Dump("BAD CONVERSION", c)
748-
base.Fatalf("converting shape type to interface")
749-
}
739+
c := n.(*ir.ConvExpr)
740+
if c.X.Type().HasShape() {
741+
ir.Dump("BAD FUNCTION", newf)
742+
ir.Dump("BAD CONVERSION", c)
743+
base.Fatalf("converting shape type to interface")
750744
}
751745
})
752746
}

0 commit comments

Comments
 (0)