github.com/neugram/ng@v0.0.0-20180309130942-d472ff93d872/eval/testdata/type-embedding.ng (about) 1 type Person struct { 2 Name string 3 } 4 5 type T struct { Person } 6 7 type P struct { *Person } 8 9 var v1 T 10 11 if v1.Person.Name != "" { 12 panic("ERROR 1") 13 } 14 15 v1.Person.Name = "gopher" 16 if v1.Person.Name != "gopher" { 17 panic("ERROR 2") 18 } 19 20 var v2 P 21 22 if v2.Person != nil { 23 panic("ERROR 3") 24 } 25 26 v2.Person = &v1.Person 27 if v2.Person.Name != "gopher" { 28 panic("ERROR 3") 29 } 30 31 print("OK")