mirror of
https://github.com/golang/go
synced 2024-09-04 23:44:16 +00:00
[dev.typeparams] go/types: rename newTypeSet -> computeTypeSet
This is a port of CL 332089 to go/types. Change-Id: I39321eaee184c8204bd255b7770a0770ecb25fda Reviewed-on: https://go-review.googlesource.com/c/go/+/335036 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:
parent
de209e693a
commit
7c35f5c2fc
|
@ -119,7 +119,7 @@ func (check *Checker) interfaceType(ityp *Interface, iface *ast.InterfaceType, d
|
||||||
// Compute type set with a non-nil *Checker as soon as possible
|
// Compute type set with a non-nil *Checker as soon as possible
|
||||||
// to report any errors. Subsequent uses of type sets should be
|
// to report any errors. Subsequent uses of type sets should be
|
||||||
// using this computed type set and won't need to pass in a *Checker.
|
// using this computed type set and won't need to pass in a *Checker.
|
||||||
check.later(func() { newTypeSet(check, iface.Pos(), ityp) })
|
check.later(func() { computeTypeSet(check, iface.Pos(), ityp) })
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenUnion(list []ast.Expr, x ast.Expr) []ast.Expr {
|
func flattenUnion(list []ast.Expr, x ast.Expr) []ast.Expr {
|
||||||
|
|
|
@ -268,7 +268,7 @@ type Interface struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// typeSet returns the type set for interface t.
|
// typeSet returns the type set for interface t.
|
||||||
func (t *Interface) typeSet() *TypeSet { return newTypeSet(nil, token.NoPos, t) }
|
func (t *Interface) typeSet() *TypeSet { return computeTypeSet(nil, token.NoPos, t) }
|
||||||
|
|
||||||
// is reports whether interface t represents types that all satisfy f.
|
// is reports whether interface t represents types that all satisfy f.
|
||||||
func (t *Interface) is(f func(Type, bool) bool) bool {
|
func (t *Interface) is(f func(Type, bool) bool) bool {
|
||||||
|
@ -634,7 +634,7 @@ func (t *TypeParam) Bound() *Interface {
|
||||||
pos = n.obj.pos
|
pos = n.obj.pos
|
||||||
}
|
}
|
||||||
// TODO(rFindley) switch this to an unexported method on Checker.
|
// TODO(rFindley) switch this to an unexported method on Checker.
|
||||||
newTypeSet(t.check, pos, iface)
|
computeTypeSet(t.check, pos, iface)
|
||||||
return iface
|
return iface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,8 @@ func (s *TypeSet) String() string {
|
||||||
// topTypeSet may be used as type set for the empty interface.
|
// topTypeSet may be used as type set for the empty interface.
|
||||||
var topTypeSet TypeSet
|
var topTypeSet TypeSet
|
||||||
|
|
||||||
// newTypeSet may be called with check == nil.
|
// computeTypeSet may be called with check == nil.
|
||||||
func newTypeSet(check *Checker, pos token.Pos, ityp *Interface) *TypeSet {
|
func computeTypeSet(check *Checker, pos token.Pos, ityp *Interface) *TypeSet {
|
||||||
if ityp.tset != nil {
|
if ityp.tset != nil {
|
||||||
return ityp.tset
|
return ityp.tset
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ func newTypeSet(check *Checker, pos token.Pos, ityp *Interface) *TypeSet {
|
||||||
var types Type
|
var types Type
|
||||||
switch t := under(typ).(type) {
|
switch t := under(typ).(type) {
|
||||||
case *Interface:
|
case *Interface:
|
||||||
tset := newTypeSet(check, pos, t)
|
tset := computeTypeSet(check, pos, t)
|
||||||
for _, m := range tset.methods {
|
for _, m := range tset.methods {
|
||||||
addMethod(pos, m, false) // use embedding position pos rather than m.pos
|
addMethod(pos, m, false) // use embedding position pos rather than m.pos
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ func (check *Checker) ordinaryType(pos positioner, typ Type) {
|
||||||
// type-checking.
|
// type-checking.
|
||||||
check.later(func() {
|
check.later(func() {
|
||||||
if t := asInterface(typ); t != nil {
|
if t := asInterface(typ); t != nil {
|
||||||
tset := newTypeSet(check, pos.Pos(), t) // TODO(gri) is this the correct position?
|
tset := computeTypeSet(check, pos.Pos(), t) // TODO(gri) is this the correct position?
|
||||||
if tset.types != nil {
|
if tset.types != nil {
|
||||||
check.softErrorf(pos, _Todo, "interface contains type constraints (%s)", tset.types)
|
check.softErrorf(pos, _Todo, "interface contains type constraints (%s)", tset.types)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue