From 4b8b2c58647af6f1979d8c53d886c8cd71c99e4b Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Fri, 19 Feb 2021 13:50:42 +0700 Subject: [PATCH] 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 Run-TryBot: Cuong Manh Le TryBot-Result: Go Bot Reviewed-by: Matthew Dempsky --- src/cmd/compile/internal/typecheck/typecheck.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/typecheck/typecheck.go b/src/cmd/compile/internal/typecheck/typecheck.go index e7d4e81672..240f0409e7 100644 --- a/src/cmd/compile/internal/typecheck/typecheck.go +++ b/src/cmd/compile/internal/typecheck/typecheck.go @@ -433,8 +433,8 @@ func typecheck(n ir.Node, top int) (res ir.Node) { case top&ctxType == 0 && n.Op() == ir.OTYPE && t != nil: if !n.Type().Broke() { base.Errorf("type %v is not an expression", n.Type()) + n.SetDiag(true) } - n.SetType(nil) case top&(ctxStmt|ctxExpr) == ctxStmt && !isStmt && t != nil: if !n.Diag() { -- 2.50.0