[dev.go2go] go/go2go: handle embedded pointers to instantiated types

Change-Id: I47d23dd4a44c644e9ec2f1abbc3cd8cec4a35d04
Reviewed-on: https://go-review.googlesource.com/c/go/+/241125
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Ian Lance Taylor 2020-07-06 16:38:12 -07:00
parent b97f992a7e
commit cfb6cac804
2 changed files with 11 additions and 0 deletions

View File

@ -798,6 +798,9 @@ func (t *translator) translateSelectorExpr(pe *ast.Expr) {
if typ == nil {
typ = f.Type()
}
if pt := typ.Pointer(); pt != nil {
typ = pt.Elem()
}
named, ok := typ.(*types.Named)
if !ok || len(named.TArgs()) == 0 {
return

View File

@ -24,6 +24,10 @@ type S2 struct {
V string
}
type S3 struct {
*T(int)
}
func main() {
var s1 S1
if s1.T.V != 0 {
@ -33,4 +37,8 @@ func main() {
if s2.Tint.V != 0 || s2.Tbool.V {
panic(s2)
}
var s3 S3
if s3.T != nil {
panic(s3)
}
}