Skip to content

Commit 7418d41

Browse files
griesemergopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> Auto-Submit: Robert Griesemer <[email protected]> Reviewed-by: Robert Findley <[email protected]>
1 parent cf760ce commit 7418d41

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

src/cmd/compile/internal/types2/api_test.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -2997,14 +2997,9 @@ type T[_ any] struct{}
29972997
type A T[B]
29982998
type B = T[A]
29992999
`
3000-
3001-
f := mustParse(src)
3002-
pkg, err := new(Config).Check("a", []*syntax.File{f}, nil)
3003-
if err != nil {
3004-
t.Fatal(err)
3005-
}
3006-
3000+
pkg := mustTypecheck(src, nil, nil)
30073001
B := pkg.Scope().Lookup("B")
3002+
30083003
got, want := Unalias(B.Type()).String(), "a.T[a.A]"
30093004
if got != want {
30103005
t.Errorf("Unalias(type B = T[A]) = %q, want %q", got, want)

src/go/types/api_test.go

+2-10
Original file line numberDiff line numberDiff line change
@@ -3005,17 +3005,9 @@ type T[_ any] struct{}
30053005
type A T[B]
30063006
type B = T[A]
30073007
`
3008-
fset := token.NewFileSet()
3009-
f, err := parser.ParseFile(fset, "a.go", src, 0)
3010-
if err != nil {
3011-
t.Fatal(err)
3012-
}
3013-
pkg, err := new(Config).Check("a", fset, []*ast.File{f}, nil)
3014-
if err != nil {
3015-
t.Fatal(err)
3016-
}
3017-
3008+
pkg := mustTypecheck(src, nil, nil)
30183009
B := pkg.Scope().Lookup("B")
3010+
30193011
got, want := Unalias(B.Type()).String(), "a.T[a.A]"
30203012
if got != want {
30213013
t.Errorf("Unalias(type B = T[A]) = %q, want %q", got, want)

0 commit comments

Comments
 (0)