diff --git a/doc/go1.18.html b/doc/go1.18.html
index 16a5a6723ca..35b3d744ece 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.
The new type
- TypeList
and factory function
- NewTypeList
facilitate storing
- a list of types.
+ TypeList
holds a list of types.
The new factory function
diff --git a/src/cmd/compile/internal/types2/check.go b/src/cmd/compile/internal/types2/check.go
index 38fc25c74db..aacbb25b3b4 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 f9423dd70ef..cda6c7baf4e 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 ababe85909d..0b77edbde25 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 56a7dcd2032..9121c2c1f64 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 38508c77a94..d967c0bd251 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 597a6da624f..e91d08cc5ee 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 ba74b8d45ab..aea19e946dd 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 0a74a875bcf..b961f7c47fc 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)
}
}