1
0
mirror of https://github.com/golang/go synced 2024-11-26 05:48:05 -07:00

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 <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Robert Findley 2021-08-16 09:36:49 -04:00
parent fda8ee8b07
commit 9ff61acbd7
4 changed files with 6 additions and 7 deletions

View 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")
}

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

View 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")
}
}

View 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("; ")