]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove -s flag
authorMatthew Dempsky <mdempsky@google.com>
Wed, 25 Sep 2019 07:14:58 +0000 (00:14 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 25 Sep 2019 17:07:00 +0000 (17:07 +0000)
This is better handled by tools like cmd/gofmt, which can
automatically rewrite the source code and already supports a syntactic
version of this simplification. (go/types can be used if
type-sensitive simplification is actually necessary.)

Change-Id: I51332a8f3ff4ab3087bc6b43a491c6d92b717228
Reviewed-on: https://go-review.googlesource.com/c/go/+/197118
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/typecheck.go

index dff33ee5308c75f0bfdc043a3807e7aec0fcf5a3..f75e35c3bee2d79e4302e48254c48278fef387fd 100644 (file)
@@ -238,7 +238,6 @@ func Main(archInit func(*Arch)) {
        if sys.RaceDetectorSupported(objabi.GOOS, objabi.GOARCH) {
                flag.BoolVar(&flag_race, "race", false, "enable race detector")
        }
-       objabi.Flagcount("s", "warn about composite literals that can be simplified", &Debug['s'])
        if enableTrace {
                flag.BoolVar(&trace, "t", false, "trace type-checking")
        }
index 48a3e1100e0fba0ea634461f54422918ca2642ca..b35ab543ec84386144a68227a77ba03fbe49573b 100644 (file)
@@ -2747,11 +2747,6 @@ func pushtype(n *Node, t *types.Type) {
                n.Right = typenod(t)
                n.SetImplicit(true)       // don't print
                n.Right.SetImplicit(true) // * is okay
-       } else if Debug['s'] != 0 {
-               n.Right = typecheck(n.Right, ctxType)
-               if n.Right.Type != nil && types.Identical(n.Right.Type, t) {
-                       fmt.Printf("%v: redundant type: %v\n", n.Line(), t)
-               }
        }
 }