aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2021-08-24 14:30:24 -0700
committerKeith Randall <khr@golang.org>2021-08-24 22:10:11 +0000
commit5d863f89fed8f0580294ada88f92f72f361c598f (patch)
tree321db5629643e02a139677cefa2df55bc48b948c /src
parentc2f96e686fe9383711d23aea95a34a280fdd0e49 (diff)
downloadgo-5d863f89fed8f0580294ada88f92f72f361c598f.tar.gz
go-5d863f89fed8f0580294ada88f92f72f361c598f.zip
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 <khr@golang.org> Trust: Dan Scales <danscales@google.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/noder/stencil.go20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go
index 602e88c102..18a0506036 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")
}
})
}