From: Robert Findley Date: Mon, 16 Aug 2021 13:36:49 +0000 (-0400) Subject: go/types,types2: superficial changes to align types and types2 X-Git-Tag: go1.18beta1~1764 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9ff61acbd7;p=gostls13.git go/types,types2: superficial changes to align types and types2 This CL contains an assortment of superficial fixes noticed while self-reviewing the most recent stack of ports. It also makes a couple adjustments to termlist_test.go, in both go/types and cmd/compile/internal/types2. Change-Id: I64c8cda5e1704e86ac11c6ffc86d55248f44ef79 Reviewed-on: https://go-review.googlesource.com/c/go/+/342490 Trust: Robert Findley Run-TryBot: Robert Findley TryBot-Result: Go Bot Reviewed-by: Robert Griesemer --- diff --git a/src/cmd/compile/internal/types2/termlist_test.go b/src/cmd/compile/internal/types2/termlist_test.go index 2f3772ddeb..ed1330d26f 100644 --- a/src/cmd/compile/internal/types2/termlist_test.go +++ b/src/cmd/compile/internal/types2/termlist_test.go @@ -11,7 +11,7 @@ import ( // maketl makes a term list from a string of the term list. func maketl(s string) termlist { - s = strings.Replace(s, " ", "", -1) + s = strings.ReplaceAll(s, " ", "") names := strings.Split(s, "∪") r := make(termlist, len(names)) for i, n := range names { @@ -20,7 +20,7 @@ func maketl(s string) termlist { return r } -func TestTermlistTop(t *testing.T) { +func TestTermlistAll(t *testing.T) { if !allTermlist.isAll() { t.Errorf("allTermlist is not the set of all types") } diff --git a/src/go/types/builtins.go b/src/go/types/builtins.go index 2099a92acb..a11f395947 100644 --- a/src/go/types/builtins.go +++ b/src/go/types/builtins.go @@ -848,7 +848,6 @@ func makeSig(res Type, args ...Type) *Signature { // arrayPtrDeref returns A if typ is of the form *A and A is an array; // otherwise it returns typ. -// func arrayPtrDeref(typ Type) Type { if p, ok := typ.(*Pointer); ok { if a := asArray(p.base); a != nil { diff --git a/src/go/types/termlist_test.go b/src/go/types/termlist_test.go index ba0faff359..d1fe28f728 100644 --- a/src/go/types/termlist_test.go +++ b/src/go/types/termlist_test.go @@ -11,7 +11,7 @@ import ( // maketl makes a term list from a string of the term list. func maketl(s string) termlist { - s = strings.Replace(s, " ", "", -1) + s = strings.ReplaceAll(s, " ", "") names := strings.Split(s, "∪") r := make(termlist, len(names)) for i, n := range names { @@ -20,9 +20,9 @@ func maketl(s string) termlist { return r } -func TestTermlistTop(t *testing.T) { +func TestTermlistAll(t *testing.T) { if !allTermlist.isAll() { - t.Errorf("topTermlist is not top") + t.Errorf("allTermlist is not the set of all types") } } diff --git a/src/go/types/typestring.go b/src/go/types/typestring.go index c38cfd4290..452c92f74d 100644 --- a/src/go/types/typestring.go +++ b/src/go/types/typestring.go @@ -86,7 +86,6 @@ func writeType(buf *bytes.Buffer, typ Type, qf Qualifier, visited []Type) { break } } - buf.WriteString(t.name) case *Array: @@ -147,6 +146,7 @@ func writeType(buf *bytes.Buffer, typ Type, qf Qualifier, visited []Type) { case *Interface: buf.WriteString("interface{") first := true + // print explicit interface methods and embedded types for _, m := range t.methods { if !first { buf.WriteString("; ")