From 50b7171af05531df6744cf33dabfceaa98e986e0 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Thu, 15 Oct 2020 22:49:30 +0700 Subject: [PATCH] cmd/compile: simplify exprformat untyped condition checking 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 Run-TryBot: Cuong Manh Le TryBot-Result: Go Bot Reviewed-by: Matthew Dempsky --- src/cmd/compile/internal/gc/fmt.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/gc/fmt.go b/src/cmd/compile/internal/gc/fmt.go index 36b596338f..9ba1789633 100644 --- a/src/cmd/compile/internal/gc/fmt.go +++ b/src/cmd/compile/internal/gc/fmt.go @@ -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) {