aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/termlist_test.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/termlist_test.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/termlist_test.go')
-rw-r--r--src/cmd/compile/internal/types2/termlist_test.go78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/cmd/compile/internal/types2/termlist_test.go b/src/cmd/compile/internal/types2/termlist_test.go
index c36baeb86f..706b4c9756 100644
--- a/src/cmd/compile/internal/types2/termlist_test.go
+++ b/src/cmd/compile/internal/types2/termlist_test.go
@@ -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{
"βˆ…",
- "⊀",
+ "𝓀",
"int",
"~int",
"βˆ… βˆͺ βˆ…",
- "⊀ βˆͺ ⊀",
- "βˆ… βˆͺ ⊀ βˆͺ int",
+ "𝓀 βˆͺ 𝓀",
+ "βˆ… βˆͺ 𝓀 βˆͺ 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,
- "βˆ… βˆͺ βˆ… βˆͺ ⊀": false,
- "⊀": false,
- "⊀ βˆͺ int": false,
+ "βˆ… βˆͺ βˆ… βˆͺ 𝓀": false,
+ "𝓀": false,
+ "𝓀 βˆͺ 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,
- "βˆ… βˆͺ βˆ… βˆͺ ⊀": true,
- "⊀": true,
- "⊀ βˆͺ int": true,
+ "βˆ… βˆͺ βˆ… βˆͺ 𝓀": true,
+ "𝓀": true,
+ "𝓀 βˆͺ 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"},
- {"⊀ βˆͺ int", "⊀"},
+ {"𝓀 βˆͺ int", "𝓀"},
{"~int βˆͺ int", "~int"},
{"int βˆͺ ~string βˆͺ int", "int βˆͺ ~string"},
- {"~int βˆͺ string βˆͺ ⊀ βˆͺ ~string βˆͺ int", "⊀"},
+ {"~int βˆͺ string βˆͺ 𝓀 βˆͺ ~string βˆͺ int", "𝓀"},
} {
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",
- "⊀": "nil",
+ "𝓀": "nil",
"int": "int",
"~int": "int",
"~int βˆͺ string": "nil",
@@ -128,15 +128,15 @@ func TestTermlistUnion(t *testing.T) {
}{
{"βˆ…", "βˆ…", "βˆ…"},
- {"βˆ…", "⊀", "⊀"},
+ {"βˆ…", "𝓀", "𝓀"},
{"βˆ…", "int", "int"},
- {"⊀", "~int", "⊀"},
+ {"𝓀", "~int", "𝓀"},
{"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 βˆͺ ⊀", "~string βˆͺ int", "⊀"},
+ {"~int βˆͺ string βˆͺ 𝓀", "~string βˆͺ int", "𝓀"},
} {
xl := maketl(test.xl)
yl := maketl(test.yl)
@@ -153,15 +153,15 @@ func TestTermlistIntersect(t *testing.T) {
}{
{"βˆ…", "βˆ…", "βˆ…"},
- {"βˆ…", "⊀", "βˆ…"},
+ {"βˆ…", "𝓀", "βˆ…"},
{"βˆ…", "int", "βˆ…"},
- {"⊀", "~int", "~int"},
+ {"𝓀", "~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 βˆͺ ⊀", "~string βˆͺ int", "int βˆͺ ~string"},
+ {"~int βˆͺ string βˆͺ 𝓀", "~string βˆͺ int", "int βˆͺ ~string"},
} {
xl := maketl(test.xl)
yl := maketl(test.yl)
@@ -178,10 +178,10 @@ func TestTermlistEqual(t *testing.T) {
want bool
}{
{"βˆ…", "βˆ…", true},
- {"βˆ…", "⊀", false},
- {"⊀", "⊀", true},
- {"⊀ βˆͺ int", "⊀", true},
- {"⊀ βˆͺ int", "string βˆͺ ⊀", true},
+ {"βˆ…", "𝓀", false},
+ {"𝓀", "𝓀", true},
+ {"𝓀 βˆͺ int", "𝓀", true},
+ {"𝓀 βˆͺ int", "string βˆͺ 𝓀", 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},
- {"⊀", "int", true},
+ {"𝓀", "int", true},
{"~int", "int", true},
{"int", "string", false},
{"~int", "string", false},
{"int βˆͺ string", "string", true},
{"~int βˆͺ string", "int", true},
{"~int βˆͺ string βˆͺ βˆ…", "string", true},
- {"~string βˆͺ βˆ… βˆͺ ⊀", "int", true},
+ {"~string βˆͺ βˆ… βˆͺ 𝓀", "int", true},
} {
xl := maketl(test.xl)
yl := testTerm(test.typ).typ
@@ -224,12 +224,12 @@ func TestTermlistSupersetOf(t *testing.T) {
want bool
}{
{"βˆ…", "βˆ…", true},
- {"βˆ…", "⊀", false},
+ {"βˆ…", "𝓀", false},
{"βˆ…", "int", false},
- {"⊀", "βˆ…", true},
- {"⊀", "⊀", true},
- {"⊀", "int", true},
- {"⊀", "~int", true},
+ {"𝓀", "βˆ…", true},
+ {"𝓀", "𝓀", true},
+ {"𝓀", "int", true},
+ {"𝓀", "~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 βˆͺ βˆ… βˆͺ ⊀", "int", true},
+ {"~string βˆͺ βˆ… βˆͺ 𝓀", "int", true},
} {
xl := maketl(test.xl)
y := testTerm(test.typ)
@@ -256,16 +256,16 @@ func TestTermlistSubsetOf(t *testing.T) {
want bool
}{
{"βˆ…", "βˆ…", true},
- {"βˆ…", "⊀", true},
- {"⊀", "βˆ…", false},
- {"⊀", "⊀", true},
+ {"βˆ…", "𝓀", true},
+ {"𝓀", "βˆ…", false},
+ {"𝓀", "𝓀", 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 βˆͺ ⊀", true},
+ {"int βˆͺ ~string", "string βˆͺ int βˆͺ 𝓀", true},
{"int βˆͺ ~string", "string βˆͺ int βˆͺ βˆ… βˆͺ string", false},
} {
xl := maketl(test.xl)