mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
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>
This commit is contained in:
parent
20b9aaca30
commit
f8a8a73096
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue