]> Cypherpunks repositories - gostls13.git/commitdiff
go/types, types2: simplify TestUnaliasTooSoonInCycle (cleanup)
authorRobert Griesemer <gri@golang.org>
Mon, 15 Apr 2024 19:49:21 +0000 (12:49 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 15 Apr 2024 20:09:34 +0000 (20:09 +0000)
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>
src/cmd/compile/internal/types2/api_test.go
src/go/types/api_test.go

index cd979815bfd8c9cffff2e0840b0c76e33c2e7e4d..840a3f3bdceaa561903a43126c98dd064ac14c04 100644 (file)
@@ -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)
index 5ce17e3ddc5d4c78fcfe921c1d750c763960ece7..7ab695d365faff51b5735cb370de2385955e36d1 100644 (file)
@@ -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)