mirror of
https://github.com/golang/go.git
synced 2024-09-21 18:38:37 +00:00
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>
This commit is contained in:
parent
cf760ce29c
commit
7418d419af
@ -2997,14 +2997,9 @@ type T[_ any] struct{}
|
|||||||
type A T[B]
|
type A T[B]
|
||||||
type B = T[A]
|
type B = T[A]
|
||||||
`
|
`
|
||||||
|
pkg := mustTypecheck(src, nil, nil)
|
||||||
f := mustParse(src)
|
|
||||||
pkg, err := new(Config).Check("a", []*syntax.File{f}, nil)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
B := pkg.Scope().Lookup("B")
|
B := pkg.Scope().Lookup("B")
|
||||||
|
|
||||||
got, want := Unalias(B.Type()).String(), "a.T[a.A]"
|
got, want := Unalias(B.Type()).String(), "a.T[a.A]"
|
||||||
if got != want {
|
if got != want {
|
||||||
t.Errorf("Unalias(type B = T[A]) = %q, want %q", got, want)
|
t.Errorf("Unalias(type B = T[A]) = %q, want %q", got, want)
|
||||||
|
@ -3005,17 +3005,9 @@ type T[_ any] struct{}
|
|||||||
type A T[B]
|
type A T[B]
|
||||||
type B = T[A]
|
type B = T[A]
|
||||||
`
|
`
|
||||||
fset := token.NewFileSet()
|
pkg := mustTypecheck(src, nil, nil)
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
B := pkg.Scope().Lookup("B")
|
B := pkg.Scope().Lookup("B")
|
||||||
|
|
||||||
got, want := Unalias(B.Type()).String(), "a.T[a.A]"
|
got, want := Unalias(B.Type()).String(), "a.T[a.A]"
|
||||||
if got != want {
|
if got != want {
|
||||||
t.Errorf("Unalias(type B = T[A]) = %q, want %q", got, want)
|
t.Errorf("Unalias(type B = T[A]) = %q, want %q", got, want)
|
||||||
|
Loading…
Reference in New Issue
Block a user