]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: simplify exprformat untyped condition checking
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 15 Oct 2020 15:49:30 +0000 (22:49 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 15 Oct 2020 17:21:17 +0000 (17:21 +0000)
L1337 in fmt.go can be checked just by using "!n.Type.IsUntyped".

Passes toolstash-check.

Change-Id: I5b0c81543bc929367f70713d0ca40b289f905b48
Reviewed-on: https://go-review.googlesource.com/c/go/+/262637
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/gc/fmt.go

index 36b596338fd1cb6e8f46cf83cd196d2b0e1a3a88..9ba1789633c51959688cd5601acf952da7ce83b6 100644 (file)
@@ -1333,7 +1333,7 @@ func (n *Node) exprfmt(s fmt.State, prec int, mode fmtMode) {
                        n.Orig.exprfmt(s, prec, mode)
                        return
                }
-               if n.Type != nil && n.Type.Etype != TIDEAL && n.Type.Etype != TNIL && n.Type != types.UntypedBool && n.Type != types.UntypedString {
+               if n.Type != nil && !n.Type.IsUntyped() {
                        // Need parens when type begins with what might
                        // be misinterpreted as a unary operator: * or <-.
                        if n.Type.IsPtr() || (n.Type.IsChan() && n.Type.ChanDir() == types.Crecv) {