diff options
| author | Robert Griesemer <gri@golang.org> | 2024-04-15 12:49:21 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-04-15 20:09:34 +0000 |
| commit | 7418d419afeeaa832bd5c9104f1ff90331eaf184 (patch) | |
| tree | b772e67c44fe96bb5d997dbf0fdb7d571982009e | |
| parent | cf760ce29ce96be610d79a639eb930e85f78a149 (diff) | |
| download | go-7418d419afeeaa832bd5c9104f1ff90331eaf184.tar.xz | |
go/types, types2: simplify TestUnaliasTooSoonInCycle (cleanup)
Follow-up on CL 576975 and CL 579015.
Updates #66704
Updates #65294
Change-Id: Ied95386a346be38ccda86d332d09b2089a68c5e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/579075
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
| -rw-r--r-- | src/cmd/compile/internal/types2/api_test.go | 9 | ||||
| -rw-r--r-- | src/go/types/api_test.go | 12 |
2 files changed, 4 insertions, 17 deletions
diff --git a/src/cmd/compile/internal/types2/api_test.go b/src/cmd/compile/internal/types2/api_test.go index cd979815bf..840a3f3bdc 100644 --- a/src/cmd/compile/internal/types2/api_test.go +++ b/src/cmd/compile/internal/types2/api_test.go @@ -2997,14 +2997,9 @@ type T[_ any] struct{} type A T[B] type B = T[A] ` - - f := mustParse(src) - pkg, err := new(Config).Check("a", []*syntax.File{f}, nil) - if err != nil { - t.Fatal(err) - } - + pkg := mustTypecheck(src, nil, nil) B := pkg.Scope().Lookup("B") + got, want := Unalias(B.Type()).String(), "a.T[a.A]" if got != want { t.Errorf("Unalias(type B = T[A]) = %q, want %q", got, want) diff --git a/src/go/types/api_test.go b/src/go/types/api_test.go index 5ce17e3ddc..7ab695d365 100644 --- a/src/go/types/api_test.go +++ b/src/go/types/api_test.go @@ -3005,17 +3005,9 @@ type T[_ any] struct{} type A T[B] type B = T[A] ` - fset := token.NewFileSet() - f, err := parser.ParseFile(fset, "a.go", src, 0) - if err != nil { - t.Fatal(err) - } - pkg, err := new(Config).Check("a", fset, []*ast.File{f}, nil) - if err != nil { - t.Fatal(err) - } - + pkg := mustTypecheck(src, nil, nil) B := pkg.Scope().Lookup("B") + got, want := Unalias(B.Type()).String(), "a.T[a.A]" if got != want { t.Errorf("Unalias(type B = T[A]) = %q, want %q", got, want) |
