From bb5608dd5d056519bd90666b815e0b2bf65e5ee8 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 29 Jul 2021 11:10:04 -0700 Subject: [dev.typeparams] cmd/compile/internal/types2: implement type sets with term lists This CL resolves several known issues and TODOs. - Represent type sets with term lists and using term list abstractions. - Represent Unions internally as a list of (syntactical) terms. Use term operations to print terms and detect overlapping union entries. - Compute type sets corresponding to unions lazily, on demand. - Adjust code throughout. - Adjusted error check in test/typeparam/mincheck.dir/main.go to make test pass. Change-Id: Ib36fb7e1d343c2b6aec51d304f0f7d1ad415f999 Reviewed-on: https://go-review.googlesource.com/c/go/+/338310 Trust: Robert Griesemer Reviewed-by: Robert Findley --- test/typeparam/mincheck.dir/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/typeparam/mincheck.dir/main.go b/test/typeparam/mincheck.dir/main.go index 72d8effcc5..9cf2c6bafd 100644 --- a/test/typeparam/mincheck.dir/main.go +++ b/test/typeparam/mincheck.dir/main.go @@ -28,11 +28,11 @@ func main() { } const want2 = "ay" - if got := a.Min[string]("bb", "ay"); got != want2 { // ERROR "string does not satisfy interface{int|int64|float64}" + if got := a.Min[string]("bb", "ay"); got != want2 { // ERROR "string does not satisfy" panic(fmt.Sprintf("got %d, want %d", got, want2)) } - if got := a.Min("bb", "ay"); got != want2 { // ERROR "string does not satisfy interface{int|int64|float64}" + if got := a.Min("bb", "ay"); got != want2 { // ERROR "string does not satisfy" panic(fmt.Sprintf("got %d, want %d", got, want2)) } } -- cgit v1.2.3-54-g00ecf