diff options
author | Robert Griesemer <gri@golang.org> | 2021-08-04 15:18:37 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-08-06 20:34:43 +0000 |
commit | 5aac85ad5ebfa9c2ecb01a3292bcf3513d876d7a (patch) | |
tree | c058cc9c80087967f248f1e126664cb8ea08307b /src/cmd/compile/internal/types2/termlist_test.go | |
parent | 110343e4a2a953a581e34e91e51cef08856b0b0a (diff) | |
download | go-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.go | 78 |
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) |