]> Cypherpunks repositories - gostls13.git/commitdiff
go/types,types2: superficial changes to align types and types2
authorRobert Findley <rfindley@google.com>
Mon, 16 Aug 2021 13:36:49 +0000 (09:36 -0400)
committerRobert Findley <rfindley@google.com>
Mon, 16 Aug 2021 18:43:31 +0000 (18:43 +0000)
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 <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/cmd/compile/internal/types2/termlist_test.go
src/go/types/builtins.go
src/go/types/termlist_test.go
src/go/types/typestring.go

index 2f3772ddeb80f9875f296c6d0df79f0f90b9befe..ed1330d26fcb28b87b9ed2cbe3203840086b6d96 100644 (file)
@@ -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")
        }
index 2099a92acb7652bb78748570e94721eb9619ed56..a11f395947581848d98860b3ad2105a1cf5d327f 100644 (file)
@@ -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 {
index ba0faff3591d9614b92b5a1353712dfb2bc3b1cb..d1fe28f728b30aed0419219992c65527bc21a3d8 100644 (file)
@@ -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")
        }
 }
 
index c38cfd42905807984468b7a08047d528756ca46f..452c92f74db89af56b2462cbed42f15d662a62e0 100644 (file)
@@ -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("; ")