diff options
| author | Wayne Zuo <wdvxdr@golangcn.org> | 2022-06-07 09:12:21 +0800 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2022-06-22 22:14:02 +0000 |
| commit | ff17b7d0d42af12ca1ad766a135d9951029027ea (patch) | |
| tree | 12c2c4b27e9107eff5ebfaf2d7d002b01740a813 /src/cmd/compile/internal/noder | |
| parent | 2a3b467d5f8de04a3493b7ab8cd886e109bd9283 (diff) | |
| download | go-ff17b7d0d42af12ca1ad766a135d9951029027ea.tar.xz | |
cmd/compile: don't use dictionary convert to shaped empty interface
Fixes: #53254
Change-Id: I3153d6ebb9f25957b09363f45c5cd4651ee84c2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/410655
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/cmd/compile/internal/noder')
| -rw-r--r-- | src/cmd/compile/internal/noder/stencil.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go index d463c850f3..89869c77d6 100644 --- a/src/cmd/compile/internal/noder/stencil.go +++ b/src/cmd/compile/internal/noder/stencil.go @@ -1349,7 +1349,7 @@ func (g *genInst) dictPass(info *instInfo) { mce := m.(*ir.ConvExpr) // Note: x's argument is still typed as a type parameter. // m's argument now has an instantiated type. - if mce.X.Type().HasShape() || m.Type().HasShape() { + if mce.X.Type().HasShape() || (m.Type().HasShape() && !m.Type().IsEmptyInterface()) { m = convertUsingDictionary(info, info.dictParam, m.Pos(), mce.X, m, m.Type()) } case ir.ODOTTYPE, ir.ODOTTYPE2: @@ -1446,7 +1446,7 @@ func findDictType(info *instInfo, t *types.Type) int { // instantiated node of the CONVIFACE node or XDOT node (for a bound method call) that is causing the // conversion. func convertUsingDictionary(info *instInfo, dictParam *ir.Name, pos src.XPos, v ir.Node, in ir.Node, dst *types.Type) ir.Node { - assert(v.Type().HasShape() || in.Type().HasShape()) + assert(v.Type().HasShape() || (in.Type().HasShape() && !in.Type().IsEmptyInterface())) assert(dst.IsInterface()) if v.Type().IsInterface() { |
