]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/go/types/issues_test.go
go/types, types2: introduce _Alias type node
[gostls13.git] / src / go / types / issues_test.go
index 5530fceef6d9aca01d9eaaeb5df84f53b417c288..01d739878840a18fd4951ffa42a87fc7acb01d87 100644 (file)
@@ -990,3 +990,27 @@ func f[I *T, T any]() {
                t.Fatalf("types of v and T are not pointer-identical: %p != %p", v.Type().(*TypeParam), T)
        }
 }
+
+func TestIssue44410(t *testing.T) {
+       const src = `
+package p
+
+type A = []int
+type S struct{ A }
+`
+
+       var conf Config
+       *boolFieldAddr(&conf, "_EnableAlias") = true
+       pkg := mustTypecheck(src, &conf, nil)
+
+       S := pkg.Scope().Lookup("S")
+       if S == nil {
+               t.Fatal("object S not found")
+       }
+
+       got := S.String()
+       const want = "type p.S struct{p.A /* = []int */}"
+       if got != want {
+               t.Fatalf("got %q; want %q", got, want)
+       }
+}