]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] cmd/compile/internal/types2: better names for things (cleanup)
authorRobert Griesemer <gri@golang.org>
Wed, 4 Aug 2021 22:18:37 +0000 (15:18 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 6 Aug 2021 20:34:43 +0000 (20:34 +0000)
- use the symbol 𝓤 (as in 𝓤niverse) instead of ⊤ to denote the set
  of all types (for better readabilty, ⊤ is hard to distinguish from
  T in some fonts)

- use isAll instead of isTop to test for the set of all types

- use allTermlist instead of topTermlist to denote the termlist
  representing all types

Change-Id: Idcb0b3398782b38653338e65173c0dbb935e430a
Reviewed-on: https://go-review.googlesource.com/c/go/+/339891
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/instantiate.go
src/cmd/compile/internal/types2/interface.go
src/cmd/compile/internal/types2/termlist.go
src/cmd/compile/internal/types2/termlist_test.go
src/cmd/compile/internal/types2/typeset.go
src/cmd/compile/internal/types2/typeterm.go
src/cmd/compile/internal/types2/typeterm_test.go
src/cmd/compile/internal/types2/universe.go

index b7ea193a06e770b6166f6324c739b2ebf425670d..0bb4ac956b2a281290f36b2ec3db0fa963a7c9f4 100644 (file)
@@ -174,7 +174,7 @@ func (check *Checker) satisfies(pos syntax.Pos, targ Type, tpar *TypeParam, smap
        // if iface is comparable, targ must be comparable
        // TODO(gri) the error messages needs to be better, here
        if iface.IsComparable() && !Comparable(targ) {
-               if tpar := asTypeParam(targ); tpar != nil && tpar.iface().typeSet().IsTop() {
+               if tpar := asTypeParam(targ); tpar != nil && tpar.iface().typeSet().IsAll() {
                        check.softErrorf(pos, "%s has no constraints", targ)
                        return false
                }
index aa7d0b05a0be603ee7f0eb8c1684872c556459bc..f763f8ff443e2cb81f4df58329cdab82f4a93b43 100644 (file)
@@ -92,7 +92,7 @@ func (t *Interface) NumMethods() int { return t.typeSet().NumMethods() }
 func (t *Interface) Method(i int) *Func { return t.typeSet().Method(i) }
 
 // Empty reports whether t is the empty interface.
-func (t *Interface) Empty() bool { return t.typeSet().IsTop() }
+func (t *Interface) Empty() bool { return t.typeSet().IsAll() }
 
 // IsComparable reports whether each type in interface t's type set is comparable.
 func (t *Interface) IsComparable() bool { return t.typeSet().IsComparable() }
index 07056edd974a0ca5b985557992a0e353a8e446cd..378ba6b8f4c024d02f18f090526899e720017c9b 100644 (file)
@@ -13,9 +13,9 @@ import "bytes"
 // normal form.
 type termlist []*term
 
-// topTermlist represents the set of all types.
+// allTermlist represents the set of all types.
 // It is in normal form.
-var topTermlist = termlist{new(term)}
+var allTermlist = termlist{new(term)}
 
 // String prints the termlist exactly (without normalization).
 func (xl termlist) String() string {
@@ -45,9 +45,9 @@ func (xl termlist) isEmpty() bool {
        return true
 }
 
-// isTop reports whether the termlist xl represents the set of all types.
-func (xl termlist) isTop() bool {
-       // If there's a ⊤ (top) term, the entire list is ⊤ (top).
+// isAll reports whether the termlist xl represents the set of all types.
+func (xl termlist) isAll() bool {
+       // If there's a 𝓤 term, the entire list is 𝓤.
        // If the termlist is in normal form, this requires at most
        // one iteration.
        for _, x := range xl {
@@ -74,14 +74,14 @@ func (xl termlist) norm() termlist {
                                continue
                        }
                        if u1, u2 := xi.union(xj); u2 == nil {
-                               // If we encounter a ⊤ (top) term, the entire
-                               // list is ⊤ (top). Exit early.
+                               // If we encounter a 𝓤 term, the entire list is 𝓤.
+                               // Exit early.
                                // (Note that this is not just an optimization;
-                               // if we continue, we may end up with a â\8a¤ term
+                               // if we continue, we may end up with a ð\9d\93¤ term
                                // and other terms and the result would not be
                                // in normal form.)
                                if u1.typ == nil {
-                                       return topTermlist
+                                       return allTermlist
                                }
                                xi = u1
                                used[j] = true // xj is now unioned into xi - ignore it in future iterations
@@ -92,11 +92,11 @@ func (xl termlist) norm() termlist {
        return rl
 }
 
-// If the type set represented by xl is specified by a single (non-â\8a¤) term,
+// If the type set represented by xl is specified by a single (non-ð\9d\93¤) term,
 // structuralType returns that type. Otherwise it returns nil.
 func (xl termlist) structuralType() Type {
        if nl := xl.norm(); len(nl) == 1 {
-               return nl[0].typ // if nl.isTop() then typ is nil, which is ok
+               return nl[0].typ // if nl.isAll() then typ is nil, which is ok
        }
        return nil
 }
index c36baeb86f0c9b879d256a72dcecc3a1766e9fae..706b4c975659e5c807d39e1d2a9e24fb1eff712a 100644 (file)
@@ -21,20 +21,20 @@ func maketl(s string) termlist {
 }
 
 func TestTermlistTop(t *testing.T) {
-       if !topTermlist.isTop() {
-               t.Errorf("topTermlist is not top")
+       if !allTermlist.isAll() {
+               t.Errorf("allTermlist is not the set of all types")
        }
 }
 
 func TestTermlistString(t *testing.T) {
        for _, want := range []string{
                "∅",
-               "â\8a¤",
+               "ð\9d\93¤",
                "int",
                "~int",
                "∅ ∪ ∅",
-               "â\8a¤ â\88ª â\8a¤",
-               "∅ ∪ â\8a¤ â\88ª int",
+               "ð\9d\93¤ â\88ª ð\9d\93¤",
+               "∅ ∪ ð\9d\93¤ â\88ª int",
        } {
                if got := maketl(want).String(); got != want {
                        t.Errorf("(%v).String() == %v", want, got)
@@ -46,9 +46,9 @@ func TestTermlistIsEmpty(t *testing.T) {
        for test, want := range map[string]bool{
                "∅":         true,
                "∅ ∪ ∅":     true,
-               "∅ ∪ ∅ ∪ â\8a¤": false,
-               "â\8a¤":         false,
-               "â\8a¤ â\88ª int":   false,
+               "∅ ∪ ∅ ∪ ð\9d\93¤": false,
+               "ð\9d\93¤":         false,
+               "ð\9d\93¤ â\88ª int":   false,
        } {
                xl := maketl(test)
                got := xl.isEmpty()
@@ -58,19 +58,19 @@ func TestTermlistIsEmpty(t *testing.T) {
        }
 }
 
-func TestTermlistIsTop(t *testing.T) {
+func TestTermlistIsAll(t *testing.T) {
        for test, want := range map[string]bool{
                "∅":             false,
                "∅ ∪ ∅":         false,
                "int ∪ ~string": false,
-               "∅ ∪ ∅ ∪ â\8a¤":     true,
-               "â\8a¤":             true,
-               "â\8a¤ â\88ª int":       true,
+               "∅ ∪ ∅ ∪ ð\9d\93¤":     true,
+               "ð\9d\93¤":             true,
+               "ð\9d\93¤ â\88ª int":       true,
        } {
                xl := maketl(test)
-               got := xl.isTop()
+               got := xl.isAll()
                if got != want {
-                       t.Errorf("(%v).isTop() == %v; want %v", test, got, want)
+                       t.Errorf("(%v).isAll() == %v; want %v", test, got, want)
                }
        }
 }
@@ -82,10 +82,10 @@ func TestTermlistNorm(t *testing.T) {
                {"∅", "∅"},
                {"∅ ∪ ∅", "∅"},
                {"∅ ∪ int", "int"},
-               {"â\8a¤ â\88ª int", "â\8a¤"},
+               {"ð\9d\93¤ â\88ª int", "ð\9d\93¤"},
                {"~int ∪ int", "~int"},
                {"int ∪ ~string ∪ int", "int ∪ ~string"},
-               {"~int ∪ string ∪ â\8a¤ â\88ª ~string â\88ª int", "â\8a¤"},
+               {"~int ∪ string ∪ ð\9d\93¤ â\88ª ~string â\88ª int", "ð\9d\93¤"},
        } {
                xl := maketl(test.xl)
                got := maketl(test.xl).norm()
@@ -106,7 +106,7 @@ func TestTermlistStructuralType(t *testing.T) {
 
        for test, want := range map[string]string{
                "∅":                 "nil",
-               "â\8a¤":                 "nil",
+               "ð\9d\93¤":                 "nil",
                "int":               "int",
                "~int":              "int",
                "~int ∪ string":     "nil",
@@ -128,15 +128,15 @@ func TestTermlistUnion(t *testing.T) {
        }{
 
                {"∅", "∅", "∅"},
-               {"∅", "â\8a¤", "â\8a¤"},
+               {"∅", "ð\9d\93¤", "ð\9d\93¤"},
                {"∅", "int", "int"},
-               {"â\8a¤", "~int", "â\8a¤"},
+               {"ð\9d\93¤", "~int", "ð\9d\93¤"},
                {"int", "~int", "~int"},
                {"int", "string", "int ∪ string"},
                {"int ∪ string", "~string", "int ∪ ~string"},
                {"~int ∪ string", "~string ∪ int", "~int ∪ ~string"},
                {"~int ∪ string ∪ ∅", "~string ∪ int", "~int ∪ ~string"},
-               {"~int ∪ string ∪ â\8a¤", "~string â\88ª int", "â\8a¤"},
+               {"~int ∪ string ∪ ð\9d\93¤", "~string â\88ª int", "ð\9d\93¤"},
        } {
                xl := maketl(test.xl)
                yl := maketl(test.yl)
@@ -153,15 +153,15 @@ func TestTermlistIntersect(t *testing.T) {
        }{
 
                {"∅", "∅", "∅"},
-               {"∅", "â\8a¤", "â\88\85"},
+               {"∅", "ð\9d\93¤", "â\88\85"},
                {"∅", "int", "∅"},
-               {"â\8a¤", "~int", "~int"},
+               {"ð\9d\93¤", "~int", "~int"},
                {"int", "~int", "int"},
                {"int", "string", "∅"},
                {"int ∪ string", "~string", "string"},
                {"~int ∪ string", "~string ∪ int", "int ∪ string"},
                {"~int ∪ string ∪ ∅", "~string ∪ int", "int ∪ string"},
-               {"~int ∪ string ∪ â\8a¤", "~string â\88ª int", "int â\88ª ~string"},
+               {"~int ∪ string ∪ ð\9d\93¤", "~string â\88ª int", "int â\88ª ~string"},
        } {
                xl := maketl(test.xl)
                yl := maketl(test.yl)
@@ -178,10 +178,10 @@ func TestTermlistEqual(t *testing.T) {
                want   bool
        }{
                {"∅", "∅", true},
-               {"∅", "â\8a¤", false},
-               {"â\8a¤", "â\8a¤", true},
-               {"â\8a¤ â\88ª int", "â\8a¤", true},
-               {"â\8a¤ â\88ª int", "string â\88ª â\8a¤", true},
+               {"∅", "ð\9d\93¤", false},
+               {"ð\9d\93¤", "ð\9d\93¤", true},
+               {"ð\9d\93¤ â\88ª int", "ð\9d\93¤", true},
+               {"ð\9d\93¤ â\88ª int", "string â\88ª ð\9d\93¤", true},
                {"int ∪ ~string", "string ∪ int", false},
                {"int ∪ ~string ∪ ∅", "string ∪ int ∪ ~string", true},
        } {
@@ -200,14 +200,14 @@ func TestTermlistIncludes(t *testing.T) {
                want    bool
        }{
                {"∅", "int", false},
-               {"â\8a¤", "int", true},
+               {"ð\9d\93¤", "int", true},
                {"~int", "int", true},
                {"int", "string", false},
                {"~int", "string", false},
                {"int ∪ string", "string", true},
                {"~int ∪ string", "int", true},
                {"~int ∪ string ∪ ∅", "string", true},
-               {"~string ∪ ∅ ∪ â\8a¤", "int", true},
+               {"~string ∪ ∅ ∪ ð\9d\93¤", "int", true},
        } {
                xl := maketl(test.xl)
                yl := testTerm(test.typ).typ
@@ -224,12 +224,12 @@ func TestTermlistSupersetOf(t *testing.T) {
                want    bool
        }{
                {"∅", "∅", true},
-               {"∅", "â\8a¤", false},
+               {"∅", "ð\9d\93¤", false},
                {"∅", "int", false},
-               {"â\8a¤", "â\88\85", true},
-               {"â\8a¤", "â\8a¤", true},
-               {"â\8a¤", "int", true},
-               {"â\8a¤", "~int", true},
+               {"ð\9d\93¤", "â\88\85", true},
+               {"ð\9d\93¤", "ð\9d\93¤", true},
+               {"ð\9d\93¤", "int", true},
+               {"ð\9d\93¤", "~int", true},
                {"~int", "int", true},
                {"~int", "~int", true},
                {"int", "~int", false},
@@ -239,7 +239,7 @@ func TestTermlistSupersetOf(t *testing.T) {
                {"int ∪ string", "~string", false},
                {"~int ∪ string", "int", true},
                {"~int ∪ string ∪ ∅", "string", true},
-               {"~string ∪ ∅ ∪ â\8a¤", "int", true},
+               {"~string ∪ ∅ ∪ ð\9d\93¤", "int", true},
        } {
                xl := maketl(test.xl)
                y := testTerm(test.typ)
@@ -256,16 +256,16 @@ func TestTermlistSubsetOf(t *testing.T) {
                want   bool
        }{
                {"∅", "∅", true},
-               {"∅", "â\8a¤", true},
-               {"â\8a¤", "â\88\85", false},
-               {"â\8a¤", "â\8a¤", true},
+               {"∅", "ð\9d\93¤", true},
+               {"ð\9d\93¤", "â\88\85", false},
+               {"ð\9d\93¤", "ð\9d\93¤", true},
                {"int", "int ∪ string", true},
                {"~int", "int ∪ string", false},
                {"~int", "string ∪ string ∪ int ∪ ~int", true},
                {"int ∪ string", "string", false},
                {"int ∪ string", "string ∪ int", true},
                {"int ∪ ~string", "string ∪ int", false},
-               {"int ∪ ~string", "string ∪ int ∪ â\8a¤", true},
+               {"int ∪ ~string", "string ∪ int ∪ ð\9d\93¤", true},
                {"int ∪ ~string", "string ∪ int ∪ ∅ ∪ string", false},
        } {
                xl := maketl(test.xl)
index c5fcb97ff9d2f17bb9480ab949380bd6ae77214c..83df51389b72961f7d2f22b6706dff7b3999987c 100644 (file)
@@ -25,17 +25,19 @@ type TypeSet struct {
 // IsEmpty reports whether type set s is the empty set.
 func (s *TypeSet) IsEmpty() bool { return s.terms.isEmpty() }
 
-// IsTop reports whether type set s is the set of all types (corresponding to the empty interface).
-func (s *TypeSet) IsTop() bool { return !s.comparable && len(s.methods) == 0 && s.terms.isTop() }
+// IsAll reports whether type set s is the set of all types (corresponding to the empty interface).
+func (s *TypeSet) IsAll() bool {
+       return !s.comparable && len(s.methods) == 0 && s.terms.isAll()
+}
 
 // TODO(gri) IsMethodSet is not a great name for this predicate. Find a better one.
 
 // IsMethodSet reports whether the type set s is described by a single set of methods.
-func (s *TypeSet) IsMethodSet() bool { return !s.comparable && s.terms.isTop() }
+func (s *TypeSet) IsMethodSet() bool { return !s.comparable && s.terms.isAll() }
 
 // IsComparable reports whether each type in the set is comparable.
 func (s *TypeSet) IsComparable() bool {
-       if s.terms.isTop() {
+       if s.terms.isAll() {
                return s.comparable
        }
        return s.is(func(t *term) bool {
@@ -67,8 +69,8 @@ func (s *TypeSet) String() string {
        switch {
        case s.IsEmpty():
                return "∅"
-       case s.IsTop():
-               return "â\8a¤"
+       case s.IsAll():
+               return "ð\9d\93¤"
        }
 
        hasMethods := len(s.methods) > 0
@@ -103,7 +105,7 @@ func (s *TypeSet) String() string {
 // ----------------------------------------------------------------------------
 // Implementation
 
-func (s *TypeSet) hasTerms() bool             { return !s.terms.isTop() }
+func (s *TypeSet) hasTerms() bool             { return !s.terms.isAll() }
 func (s *TypeSet) structuralType() Type       { return s.terms.structuralType() }
 func (s *TypeSet) includes(t Type) bool       { return s.terms.includes(t) }
 func (s1 *TypeSet) subsetOf(s2 *TypeSet) bool { return s1.terms.subsetOf(s2.terms) }
@@ -156,7 +158,7 @@ func (s *TypeSet) underIs(f func(Type) bool) bool {
 }
 
 // topTypeSet may be used as type set for the empty interface.
-var topTypeSet = TypeSet{terms: topTermlist}
+var topTypeSet = TypeSet{terms: allTermlist}
 
 // computeInterfaceTypeSet may be called with check == nil.
 func computeInterfaceTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *TypeSet {
@@ -195,7 +197,7 @@ func computeInterfaceTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *T
        // have valid interfaces. Mark the interface as complete to avoid
        // infinite recursion if the validType check occurs later for some
        // reason.
-       ityp.tset = &TypeSet{terms: topTermlist} // TODO(gri) is this sufficient?
+       ityp.tset = &TypeSet{terms: allTermlist} // TODO(gri) is this sufficient?
 
        // Methods of embedded interfaces are collected unchanged; i.e., the identity
        // of a method I.m's Func Object of an interface I is the same as that of
@@ -256,7 +258,7 @@ func computeInterfaceTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *T
        }
 
        // collect embedded elements
-       var allTerms = topTermlist
+       var allTerms = allTermlist
        for i, typ := range ityp.embeddeds {
                // The embedding position is nil for imported interfaces
                // and also for interface copies after substitution (but
index 59a89cb004cdab4c4e2a240730d7b5a1ec5638e6..8edbefa579ee7ae7133575b516c4c3f21ac65aff 100644 (file)
@@ -4,13 +4,10 @@
 
 package types2
 
-// TODO(gri) use a different symbol instead of ⊤ for the set of all types
-//           (⊤ is hard to distinguish from T in some fonts)
-
 // A term describes elementary type sets:
 //
 //   ∅:  (*term)(nil)     == ∅                      // set of no types (empty set)
-//   ⊤:  &term{}          == ⊤                      // set of all types
+//   𝓤:  &term{}          == 𝓤                      // set of all types (𝓤niverse)
 //   T:  &term{false, T}  == {T}                    // set of type T
 //  ~t:  &term{true, t}   == {t' | under(t') == t}  // set of types with underlying type t
 //
@@ -24,7 +21,7 @@ func (x *term) String() string {
        case x == nil:
                return "∅"
        case x.typ == nil:
-               return "â\8a¤"
+               return "ð\9d\93¤"
        case x.tilde:
                return "~" + x.typ.String()
        default:
@@ -41,7 +38,7 @@ func (x *term) equal(y *term) bool {
        case x.typ == nil || y.typ == nil:
                return x.typ == y.typ
        }
-       // ∅ ⊂ x, y ⊂ â\8a¤
+       // ∅ ⊂ x, y ⊂ ð\9d\93¤
 
        return x.tilde == y.tilde && Identical(x.typ, y.typ)
 }
@@ -57,11 +54,11 @@ func (x *term) union(y *term) (_, _ *term) {
        case y == nil:
                return x, nil // x ∪ ∅ == x
        case x.typ == nil:
-               return x, nil // â\8a¤ â\88ª y == â\8a¤
+               return x, nil // ð\9d\93¤ â\88ª y == ð\9d\93¤
        case y.typ == nil:
-               return y, nil // x ∪ â\8a¤ == â\8a¤
+               return y, nil // x ∪ ð\9d\93¤ == ð\9d\93¤
        }
-       // ∅ ⊂ x, y ⊂ â\8a¤
+       // ∅ ⊂ x, y ⊂ ð\9d\93¤
 
        if x.disjoint(y) {
                return x, y // x ∪ y == (x, y) if x ∩ y == ∅
@@ -85,11 +82,11 @@ func (x *term) intersect(y *term) *term {
        case x == nil || y == nil:
                return nil // ∅ ∩ y == ∅ and ∩ ∅ == ∅
        case x.typ == nil:
-               return y // â\8a¤ â\88© y == y
+               return y // ð\9d\93¤ â\88© y == y
        case y.typ == nil:
-               return x // x ∩ â\8a¤ == x
+               return x // x ∩ ð\9d\93¤ == x
        }
-       // ∅ ⊂ x, y ⊂ â\8a¤
+       // ∅ ⊂ x, y ⊂ ð\9d\93¤
 
        if x.disjoint(y) {
                return nil // x ∩ y == ∅ if x ∩ y == ∅
@@ -113,9 +110,9 @@ func (x *term) includes(t Type) bool {
        case x == nil:
                return false // t ∈ ∅ == false
        case x.typ == nil:
-               return true // t ∈ â\8a¤ == true
+               return true // t ∈ ð\9d\93¤ == true
        }
-       // ∅ ⊂ x ⊂ â\8a¤
+       // ∅ ⊂ x ⊂ ð\9d\93¤
 
        u := t
        if x.tilde {
@@ -133,11 +130,11 @@ func (x *term) subsetOf(y *term) bool {
        case y == nil:
                return false // x ⊆ ∅ == false since x != ∅
        case y.typ == nil:
-               return true // x ⊆ â\8a¤ == true
+               return true // x ⊆ ð\9d\93¤ == true
        case x.typ == nil:
-               return false // â\8a¤ â\8a\86 y == false since y != â\8a¤
+               return false // ð\9d\93¤ â\8a\86 y == false since y != ð\9d\93¤
        }
-       // ∅ ⊂ x, y ⊂ â\8a¤
+       // ∅ ⊂ x, y ⊂ ð\9d\93¤
 
        if x.disjoint(y) {
                return false // x ⊆ y == false if x ∩ y == ∅
index cc4e30d9893faa2322aa36171ca78fc44c875243..a8cc362f569e4e006f5203399c4e7ca7cfeb020b 100644 (file)
@@ -11,7 +11,7 @@ import (
 
 var testTerms = map[string]*term{
        "∅":       nil,
-       "â\8a¤":       {},
+       "ð\9d\93¤":       {},
        "int":     {false, Typ[Int]},
        "~int":    {true, Typ[Int]},
        "string":  {false, Typ[String]},
@@ -46,14 +46,14 @@ func testTerm(name string) *term {
 func TestTermEqual(t *testing.T) {
        for _, test := range []string{
                "∅ ∅ T",
-               "â\8a¤ â\8a¤ T",
+               "ð\9d\93¤ ð\9d\93¤ T",
                "int int T",
                "~int ~int T",
-               "∅ â\8a¤ F",
+               "∅ ð\9d\93¤ F",
                "∅ int F",
                "∅ ~int F",
-               "â\8a¤ int F",
-               "â\8a¤ ~int F",
+               "ð\9d\93¤ int F",
+               "ð\9d\93¤ ~int F",
                "int ~int F",
        } {
                args := split(test, 3)
@@ -74,12 +74,12 @@ func TestTermEqual(t *testing.T) {
 func TestTermUnion(t *testing.T) {
        for _, test := range []string{
                "∅ ∅ ∅ ∅",
-               "∅ â\8a¤ â\8a¤ â\88\85",
+               "∅ ð\9d\93¤ ð\9d\93¤ â\88\85",
                "∅ int int ∅",
                "∅ ~int ~int ∅",
-               "â\8a¤ â\8a¤ â\8a¤ â\88\85",
-               "â\8a¤ int â\8a¤ â\88\85",
-               "â\8a¤ ~int â\8a¤ â\88\85",
+               "ð\9d\93¤ ð\9d\93¤ ð\9d\93¤ â\88\85",
+               "ð\9d\93¤ int ð\9d\93¤ â\88\85",
+               "ð\9d\93¤ ~int ð\9d\93¤ â\88\85",
                "int int int ∅",
                "int ~int ~int ∅",
                "int string int string",
@@ -87,11 +87,11 @@ func TestTermUnion(t *testing.T) {
                "~int ~string ~int ~string",
 
                // union is symmetric, but the result order isn't - repeat symmetric cases explictly
-               "â\8a¤ â\88\85 â\8a¤ â\88\85",
+               "ð\9d\93¤ â\88\85 ð\9d\93¤ â\88\85",
                "int ∅ int ∅",
                "~int ∅ ~int ∅",
-               "int â\8a¤ â\8a¤ â\88\85",
-               "~int â\8a¤ â\8a¤ â\88\85",
+               "int ð\9d\93¤ ð\9d\93¤ â\88\85",
+               "~int ð\9d\93¤ ð\9d\93¤ â\88\85",
                "~int int ~int ∅",
                "string int string int",
                "~string int ~string int",
@@ -111,12 +111,12 @@ func TestTermUnion(t *testing.T) {
 func TestTermIntersection(t *testing.T) {
        for _, test := range []string{
                "∅ ∅ ∅",
-               "∅ â\8a¤ â\88\85",
+               "∅ ð\9d\93¤ â\88\85",
                "∅ int ∅",
                "∅ ~int ∅",
-               "â\8a¤ â\8a¤ â\8a¤",
-               "â\8a¤ int int",
-               "â\8a¤ ~int ~int",
+               "ð\9d\93¤ ð\9d\93¤ ð\9d\93¤",
+               "ð\9d\93¤ int int",
+               "ð\9d\93¤ ~int ~int",
                "int int int",
                "int ~int int",
                "int string ∅",
@@ -141,7 +141,7 @@ func TestTermIntersection(t *testing.T) {
 func TestTermIncludes(t *testing.T) {
        for _, test := range []string{
                "∅ int F",
-               "â\8a¤ int T",
+               "ð\9d\93¤ int T",
                "int int T",
                "~int int T",
                "string int F",
@@ -160,14 +160,14 @@ func TestTermIncludes(t *testing.T) {
 func TestTermSubsetOf(t *testing.T) {
        for _, test := range []string{
                "∅ ∅ T",
-               "â\8a¤ â\8a¤ T",
+               "ð\9d\93¤ ð\9d\93¤ T",
                "int int T",
                "~int ~int T",
-               "∅ â\8a¤ T",
+               "∅ ð\9d\93¤ T",
                "∅ int T",
                "∅ ~int T",
-               "â\8a¤ int F",
-               "â\8a¤ ~int F",
+               "ð\9d\93¤ int F",
+               "ð\9d\93¤ ~int F",
                "int ~int T",
        } {
                args := split(test, 3)
index 55bf0982b302e1808d8e2d958dceed247fd396e7..f14c0792229ce56417ef326819de51d65f27962c 100644 (file)
@@ -99,7 +99,7 @@ func defPredeclaredTypes() {
        {
                obj := NewTypeName(nopos, nil, "comparable", nil)
                obj.setColor(black)
-               ityp := &Interface{obj, nil, nil, nil, true, &TypeSet{true, nil, topTermlist}}
+               ityp := &Interface{obj, nil, nil, nil, true, &TypeSet{true, nil, allTermlist}}
                NewNamed(obj, ityp, nil)
                def(obj)
        }