1
0
mirror of https://github.com/golang/go synced 2024-11-08 09:36:24 -07:00

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 <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 2020-10-15 22:49:30 +07:00
parent 623319a847
commit 50b7171af0

View 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) {