]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] go/types: print "incomplete" for interfaces in debug mode only
authorRob Findley <rfindley@google.com>
Thu, 3 Jun 2021 13:49:21 +0000 (09:49 -0400)
committerRobert Findley <rfindley@google.com>
Fri, 4 Jun 2021 10:59:00 +0000 (10:59 +0000)
This is a straightforward port of CL 320150 to go/types.

Fixes #46167

Change-Id: Id1845046f598ac4fefd68cda6a5a03b7a5fc5a4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/324731
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/types_test.go
src/go/types/typestring.go
src/go/types/typestring_test.go

index e1a40f1f6e1f223a07eb1975f25c3699ae4f31be..7990414f4245beeeb0365e27b0d17beb6ce4d0f5 100644 (file)
@@ -9,3 +9,6 @@ package types
 func SetGoVersion(config *Config, goVersion string) {
        config.goVersion = goVersion
 }
+
+// Debug is set if go/types is built with debug mode enabled.
+const Debug = debug
index fe27f0f276c30e5127b2a0d61c1145b56b1105cf..ff93f3b3c31f289f37c299bbff5d6acdf54f80af 100644 (file)
@@ -227,7 +227,7 @@ func writeType(buf *bytes.Buffer, typ Type, qf Qualifier, visited []Type) {
                                empty = false
                        }
                }
-               if t.allMethods == nil || len(t.methods) > len(t.allMethods) {
+               if debug && (t.allMethods == nil || len(t.methods) > len(t.allMethods)) {
                        if !empty {
                                buf.WriteByte(' ')
                        }
index b16529dc64155cc306d1233d30b5d3d921dbf764..55ee4b987f7d653e0ddc68f911bf427fb7fc32a0 100644 (file)
@@ -143,6 +143,10 @@ func TestTypeString(t *testing.T) {
 }
 
 func TestIncompleteInterfaces(t *testing.T) {
+       if !Debug {
+               t.Skip("requires type checker to be compiled with debug = true")
+       }
+
        sig := NewSignature(nil, nil, nil, false)
        m := NewFunc(token.NoPos, nil, "m", sig)
        for _, test := range []struct {