diff options
| author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2022-06-11 01:33:11 +0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2022-06-13 16:53:11 +0000 |
| commit | 7eeec1f6e4b9359381e9aeffdb87c59308ecbb7e (patch) | |
| tree | bfe1ae7dd68426bb39f477eeaed0462472837597 /src | |
| parent | d27128b065010ac6bae8dd648f85302240417294 (diff) | |
| download | go-7eeec1f6e4b9359381e9aeffdb87c59308ecbb7e.tar.xz | |
cmd/compile: fix missing dict pass for type assertions
For type assertions, if either src or dst type has shape, we must
convert them to dynamic type assertions.
Fixes #53309
Change-Id: Ia3362fa67c011febcbdb5b26f856d081b5c366de
Reviewed-on: https://go-review.googlesource.com/c/go/+/411617
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src')
| -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 88e4961666..3f12aa3cbd 100644 --- a/src/cmd/compile/internal/noder/stencil.go +++ b/src/cmd/compile/internal/noder/stencil.go @@ -1330,10 +1330,10 @@ func (g *genInst) dictPass(info *instInfo) { m = convertUsingDictionary(info, info.dictParam, m.Pos(), mce.X, m, m.Type()) } case ir.ODOTTYPE, ir.ODOTTYPE2: - if !m.Type().HasShape() { + dt := m.(*ir.TypeAssertExpr) + if !dt.Type().HasShape() && !dt.X.Type().HasShape() { break } - dt := m.(*ir.TypeAssertExpr) var rtype, itab ir.Node if dt.Type().IsInterface() || dt.X.Type().IsEmptyInterface() { // TODO(mdempsky): Investigate executing this block unconditionally. |
