aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Findley <rfindley@google.com>2021-12-05 22:18:04 -0500
committerRobert Findley <rfindley@google.com>2021-12-06 14:58:33 +0000
commitf8a8a73096a4d36ce7d35e9643db89e669bbee1f (patch)
treef0c40e6d021f1204ed0b436e68fd92b4bf3eae70
parent20b9aaca30f7caa5a7cdd05fe0c2e18f64b04a16 (diff)
downloadgo-f8a8a73096a4d36ce7d35e9643db89e669bbee1f.tar.xz
go/types, types2: unexport NewTypeList
NewTypeList was not part of the go/types API proposal, and was left in by accident. It also shouldn't be necessary, so remove it. Updates #47916 Change-Id: I4db3ccf036ccfb708ecf2c176ea4921fe68089a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/369475 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
-rw-r--r--doc/go1.18.html4
-rw-r--r--src/cmd/compile/internal/types2/check.go2
-rw-r--r--src/cmd/compile/internal/types2/instantiate.go2
-rw-r--r--src/cmd/compile/internal/types2/typelists.go4
-rw-r--r--src/cmd/compile/internal/types2/typexpr.go4
-rw-r--r--src/go/types/check.go2
-rw-r--r--src/go/types/instantiate.go2
-rw-r--r--src/go/types/typelists.go4
-rw-r--r--src/go/types/typexpr.go4
9 files changed, 13 insertions, 15 deletions
diff --git a/doc/go1.18.html b/doc/go1.18.html
index 16a5a6723c..35b3d744ec 100644
--- a/doc/go1.18.html
+++ b/doc/go1.18.html
@@ -516,9 +516,7 @@ Do not send CLs removing the interior tags from such phrases.
</li>
<li>
The new type
- <a href="/pkg/go/types/#TypeList"><code>TypeList</code></a> and factory function
- <a href="/pkg/go/types/#NewTypeList"><code>NewTypeList</code></a> facilitate storing
- a list of types.
+ <a href="/pkg/go/types/#TypeList"><code>TypeList</code></a> holds a list of types.
</li>
<li>
The new factory function
diff --git a/src/cmd/compile/internal/types2/check.go b/src/cmd/compile/internal/types2/check.go
index 38fc25c74d..aacbb25b3b 100644
--- a/src/cmd/compile/internal/types2/check.go
+++ b/src/cmd/compile/internal/types2/check.go
@@ -494,7 +494,7 @@ func (check *Checker) recordInstance(expr syntax.Expr, targs []Type, typ Type) {
assert(ident != nil)
assert(typ != nil)
if m := check.Instances; m != nil {
- m[ident] = Instance{NewTypeList(targs), typ}
+ m[ident] = Instance{newTypeList(targs), typ}
}
}
diff --git a/src/cmd/compile/internal/types2/instantiate.go b/src/cmd/compile/internal/types2/instantiate.go
index f9423dd70e..cda6c7baf4 100644
--- a/src/cmd/compile/internal/types2/instantiate.go
+++ b/src/cmd/compile/internal/types2/instantiate.go
@@ -77,7 +77,7 @@ func (check *Checker) instance(pos syntax.Pos, orig Type, targs []Type, ctxt *Co
case *Named:
tname := NewTypeName(pos, orig.obj.pkg, orig.obj.name, nil)
named := check.newNamed(tname, orig, nil, nil, nil) // underlying, tparams, and methods are set when named is resolved
- named.targs = NewTypeList(targs)
+ named.targs = newTypeList(targs)
named.resolver = func(ctxt *Context, n *Named) (*TypeParamList, Type, []*Func) {
return expandNamed(ctxt, n, pos)
}
diff --git a/src/cmd/compile/internal/types2/typelists.go b/src/cmd/compile/internal/types2/typelists.go
index ababe85909..0b77edbde2 100644
--- a/src/cmd/compile/internal/types2/typelists.go
+++ b/src/cmd/compile/internal/types2/typelists.go
@@ -29,8 +29,8 @@ func (l *TypeParamList) list() []*TypeParam {
// TypeList holds a list of types.
type TypeList struct{ types []Type }
-// NewTypeList returns a new TypeList with the types in list.
-func NewTypeList(list []Type) *TypeList {
+// newTypeList returns a new TypeList with the types in list.
+func newTypeList(list []Type) *TypeList {
if len(list) == 0 {
return nil
}
diff --git a/src/cmd/compile/internal/types2/typexpr.go b/src/cmd/compile/internal/types2/typexpr.go
index 56a7dcd203..9121c2c1f6 100644
--- a/src/cmd/compile/internal/types2/typexpr.go
+++ b/src/cmd/compile/internal/types2/typexpr.go
@@ -442,7 +442,7 @@ func (check *Checker) instantiatedType(x syntax.Expr, xlist []syntax.Expr, def *
if inst == nil {
tname := NewTypeName(x.Pos(), orig.obj.pkg, orig.obj.name, nil)
inst = check.newNamed(tname, orig, nil, nil, nil) // underlying, methods and tparams are set when named is resolved
- inst.targs = NewTypeList(targs)
+ inst.targs = newTypeList(targs)
inst = ctxt.update(h, orig, targs, inst).(*Named)
}
def.setUnderlying(inst)
@@ -456,7 +456,7 @@ func (check *Checker) instantiatedType(x syntax.Expr, xlist []syntax.Expr, def *
// be set to Typ[Invalid] in expandNamed.
inferred = check.infer(x.Pos(), tparams, targs, nil, nil)
if len(inferred) > len(targs) {
- inst.targs = NewTypeList(inferred)
+ inst.targs = newTypeList(inferred)
}
}
diff --git a/src/go/types/check.go b/src/go/types/check.go
index 38508c77a9..d967c0bd25 100644
--- a/src/go/types/check.go
+++ b/src/go/types/check.go
@@ -487,7 +487,7 @@ func (check *Checker) recordInstance(expr ast.Expr, targs []Type, typ Type) {
assert(ident != nil)
assert(typ != nil)
if m := check.Instances; m != nil {
- m[ident] = Instance{NewTypeList(targs), typ}
+ m[ident] = Instance{newTypeList(targs), typ}
}
}
diff --git a/src/go/types/instantiate.go b/src/go/types/instantiate.go
index 597a6da624..e91d08cc5e 100644
--- a/src/go/types/instantiate.go
+++ b/src/go/types/instantiate.go
@@ -77,7 +77,7 @@ func (check *Checker) instance(pos token.Pos, orig Type, targs []Type, ctxt *Con
case *Named:
tname := NewTypeName(pos, orig.obj.pkg, orig.obj.name, nil)
named := check.newNamed(tname, orig, nil, nil, nil) // underlying, tparams, and methods are set when named is resolved
- named.targs = NewTypeList(targs)
+ named.targs = newTypeList(targs)
named.resolver = func(ctxt *Context, n *Named) (*TypeParamList, Type, []*Func) {
return expandNamed(ctxt, n, pos)
}
diff --git a/src/go/types/typelists.go b/src/go/types/typelists.go
index ba74b8d45a..aea19e946d 100644
--- a/src/go/types/typelists.go
+++ b/src/go/types/typelists.go
@@ -29,8 +29,8 @@ func (l *TypeParamList) list() []*TypeParam {
// TypeList holds a list of types.
type TypeList struct{ types []Type }
-// NewTypeList returns a new TypeList with the types in list.
-func NewTypeList(list []Type) *TypeList {
+// newTypeList returns a new TypeList with the types in list.
+func newTypeList(list []Type) *TypeList {
if len(list) == 0 {
return nil
}
diff --git a/src/go/types/typexpr.go b/src/go/types/typexpr.go
index 0a74a875bc..b961f7c47f 100644
--- a/src/go/types/typexpr.go
+++ b/src/go/types/typexpr.go
@@ -427,7 +427,7 @@ func (check *Checker) instantiatedType(ix *typeparams.IndexExpr, def *Named) (re
if inst == nil {
tname := NewTypeName(ix.X.Pos(), orig.obj.pkg, orig.obj.name, nil)
inst = check.newNamed(tname, orig, nil, nil, nil) // underlying, methods and tparams are set when named is resolved
- inst.targs = NewTypeList(targs)
+ inst.targs = newTypeList(targs)
inst = ctxt.update(h, orig, targs, inst).(*Named)
}
def.setUnderlying(inst)
@@ -441,7 +441,7 @@ func (check *Checker) instantiatedType(ix *typeparams.IndexExpr, def *Named) (re
// be set to Typ[Invalid] in expandNamed.
inferred = check.infer(ix.Orig, tparams, targs, nil, nil)
if len(inferred) > len(targs) {
- inst.targs = NewTypeList(inferred)
+ inst.targs = newTypeList(inferred)
}
}