aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/typeterm.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-08-04 15:18:37 -0700
committerRobert Griesemer <gri@golang.org>2021-08-06 20:34:43 +0000
commit5aac85ad5ebfa9c2ecb01a3292bcf3513d876d7a (patch)
treec058cc9c80087967f248f1e126664cb8ea08307b /src/cmd/compile/internal/types2/typeterm.go
parent110343e4a2a953a581e34e91e51cef08856b0b0a (diff)
downloadgo-5aac85ad5ebfa9c2ecb01a3292bcf3513d876d7a.tar.gz
go-5aac85ad5ebfa9c2ecb01a3292bcf3513d876d7a.zip
[dev.typeparams] cmd/compile/internal/types2: better names for things (cleanup)
- 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>
Diffstat (limited to 'src/cmd/compile/internal/types2/typeterm.go')
-rw-r--r--src/cmd/compile/internal/types2/typeterm.go31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/cmd/compile/internal/types2/typeterm.go b/src/cmd/compile/internal/types2/typeterm.go
index 59a89cb004..8edbefa579 100644
--- a/src/cmd/compile/internal/types2/typeterm.go
+++ b/src/cmd/compile/internal/types2/typeterm.go
@@ -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 "⊀"
+ return "𝓀"
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 βŠ‚ ⊀
+ // βˆ… βŠ‚ x, y βŠ‚ 𝓀
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 // ⊀ βˆͺ y == ⊀
+ return x, nil // 𝓀 βˆͺ y == 𝓀
case y.typ == nil:
- return y, nil // x βˆͺ ⊀ == ⊀
+ return y, nil // x βˆͺ 𝓀 == 𝓀
}
- // βˆ… βŠ‚ x, y βŠ‚ ⊀
+ // βˆ… βŠ‚ x, y βŠ‚ 𝓀
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 // ⊀ ∩ y == y
+ return y // 𝓀 ∩ y == y
case y.typ == nil:
- return x // x ∩ ⊀ == x
+ return x // x ∩ 𝓀 == x
}
- // βˆ… βŠ‚ x, y βŠ‚ ⊀
+ // βˆ… βŠ‚ x, y βŠ‚ 𝓀
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 ∈ ⊀ == true
+ return true // t ∈ 𝓀 == true
}
- // βˆ… βŠ‚ x βŠ‚ ⊀
+ // βˆ… βŠ‚ x βŠ‚ 𝓀
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 βŠ† ⊀ == true
+ return true // x βŠ† 𝓀 == true
case x.typ == nil:
- return false // ⊀ βŠ† y == false since y != ⊀
+ return false // 𝓀 βŠ† y == false since y != 𝓀
}
- // βˆ… βŠ‚ x, y βŠ‚ ⊀
+ // βˆ… βŠ‚ x, y βŠ‚ 𝓀
if x.disjoint(y) {
return false // x βŠ† y == false if x ∩ y == βˆ