You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a minimized repro of another gotypesalias=1 problem affecting the x/tools gcimporter.
The root cause is clearly in go/types (at b24ec88).
package types // "go/types"funcTestAliasProblem(t*testing.T) {
t.Setenv("GODEBUG", "gotypesalias=1")
constsrc=`package avar x T[B] // <-- this causes the problem! deleting it causes type of B to be oktype T[_ any] struct{}type A T[B]type B = T[A]`fset:=token.NewFileSet()
f, err:=parser.ParseFile(fset, "a.go", src, 0)
iferr!=nil {
t.Fatal(err)
}
pkg, err:=new(Config).Check("a", fset, []*ast.File{f}, nil)
iferr!=nil {
t.Fatal(err)
}
B:=pkg.Scope().Lookup("B")
t.Error(Unalias(B.Type())) // "invalid type" if var x is present, "a.T[a.A]" otherwise
}