Skip to content

Commit

Permalink
go/types, types2: simplify TestUnaliasTooSoonInCycle (cleanup)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
griesemer authored and gopherbot committed Apr 15, 2024
1 parent cf760ce commit 7418d41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
9 changes: 2 additions & 7 deletions src/cmd/compile/internal/types2/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 2 additions & 10 deletions src/go/types/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7418d41

Please sign in to comment.