1
0
mirror of https://github.com/golang/go synced 2024-11-08 04:56:16 -07:00

cmd/compile: do not set type for OTYPE

That's an invalid operation and depend on gc.hidePanic to report error.

Updates #43311

Change-Id: Ib0761dcf4d9d2a23c41de7eff0376677a90b942e
Reviewed-on: https://go-review.googlesource.com/c/go/+/294033
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Cuong Manh Le 2021-02-19 13:50:42 +07:00
parent 8c22874e4e
commit 4b8b2c5864

View File

@ -433,8 +433,8 @@ func typecheck(n ir.Node, top int) (res ir.Node) {
case top&ctxType == 0 && n.Op() == ir.OTYPE && t != nil: case top&ctxType == 0 && n.Op() == ir.OTYPE && t != nil:
if !n.Type().Broke() { if !n.Type().Broke() {
base.Errorf("type %v is not an expression", n.Type()) base.Errorf("type %v is not an expression", n.Type())
n.SetDiag(true)
} }
n.SetType(nil)
case top&(ctxStmt|ctxExpr) == ctxStmt && !isStmt && t != nil: case top&(ctxStmt|ctxExpr) == ctxStmt && !isStmt && t != nil:
if !n.Diag() { if !n.Diag() {