]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: do not set type for OTYPE
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 19 Feb 2021 06:50:42 +0000 (13:50 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 4 Mar 2021 06:36:17 +0000 (06:36 +0000)
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>
src/cmd/compile/internal/typecheck/typecheck.go

index e7d4e81672d7c9517f510b4b87a37ccc936910e6..240f0409e77391546b12308befbb6e80069ada6a 100644 (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:
                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() {