]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] cmd/compile/internal/types2: rename newTypeSet -> computeTypeSet
authorRobert Griesemer <gri@golang.org>
Wed, 30 Jun 2021 19:45:51 +0000 (12:45 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 1 Jul 2021 16:43:23 +0000 (16:43 +0000)
Follow-up on comment in https://golang.org/cl/329309.

Change-Id: I31f746180237b916c1825fa1688641849478ba41
Reviewed-on: https://go-review.googlesource.com/c/go/+/332089
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/interface.go
src/cmd/compile/internal/types2/type.go
src/cmd/compile/internal/types2/typeset.go
src/cmd/compile/internal/types2/typexpr.go

index 18dc573340bb52fd55bb9658864ccdfd6cc31e3e..1f4e80951a2dccc0fa2b60782b85a50548413ed8 100644 (file)
@@ -114,7 +114,7 @@ func (check *Checker) interfaceType(ityp *Interface, iface *syntax.InterfaceType
        // Compute type set with a non-nil *Checker as soon as possible
        // 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.
-       check.later(func() { newTypeSet(check, iface.Pos(), ityp) })
+       check.later(func() { computeTypeSet(check, iface.Pos(), ityp) })
 }
 
 func flattenUnion(list []syntax.Expr, x syntax.Expr) []syntax.Expr {
index f8aa453d5ca553f10e346ba729f241a567fabe7b..b41dceea7003c2fd51f3b78e57c9d36bd7a77de2 100644 (file)
@@ -274,7 +274,7 @@ type Interface struct {
 }
 
 // typeSet returns the type set for interface t.
-func (t *Interface) typeSet() *TypeSet { return newTypeSet(nil, nopos, t) }
+func (t *Interface) typeSet() *TypeSet { return computeTypeSet(nil, nopos, t) }
 
 // is reports whether interface t represents types that all satisfy f.
 func (t *Interface) is(f func(Type, bool) bool) bool {
@@ -637,7 +637,7 @@ func (t *TypeParam) Bound() *Interface {
                pos = n.obj.pos
        }
        // TODO(gri) switch this to an unexported method on Checker.
-       newTypeSet(t.check, pos, iface)
+       computeTypeSet(t.check, pos, iface)
        return iface
 }
 
index ce4a776f8f09551d76e286e212da4cbc48279d9f..265221501f26dc13655aec6017bb9e7a9e74b029 100644 (file)
@@ -78,8 +78,8 @@ func (s *TypeSet) String() string {
 // topTypeSet may be used as type set for the empty interface.
 var topTypeSet TypeSet
 
-// newTypeSet may be called with check == nil.
-func newTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *TypeSet {
+// computeTypeSet may be called with check == nil.
+func computeTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *TypeSet {
        if ityp.tset != nil {
                return ityp.tset
        }
@@ -188,7 +188,7 @@ func newTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *TypeSet {
                var types Type
                switch t := under(typ).(type) {
                case *Interface:
-                       tset := newTypeSet(check, pos, t)
+                       tset := computeTypeSet(check, pos, t)
                        for _, m := range tset.methods {
                                addMethod(pos, m, false) // use embedding position pos rather than m.pos
                        }
index 5626fed7568bcc03d17e9a2d10ebdd5165e5246d..e861f7e78489df0866653505b6a3854b18f19ccf 100644 (file)
@@ -141,7 +141,7 @@ func (check *Checker) ordinaryType(pos syntax.Pos, typ Type) {
        // interface methods. Delay this check to the end of type-checking.
        check.later(func() {
                if t := asInterface(typ); t != nil {
-                       tset := newTypeSet(check, pos, t) // TODO(gri) is this the correct position?
+                       tset := computeTypeSet(check, pos, t) // TODO(gri) is this the correct position?
                        if tset.types != nil {
                                check.softErrorf(pos, "interface contains type constraints (%s)", tset.types)
                                return