1 // $G $D/$F.go && $L $F.$A && ./$A.out
3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
24 type SubpSubp
struct {
29 func (p
*SubpSubp
) test7() int {
31 println("SubpSubp", p
, p
.a7
)
36 func (p
*SubpSubp
) testx() { println("SubpSubp", p
, p
.a7
) }
48 func (p
*SubpSub
) test6() int {
50 println("SubpSub", p
, p
.a6
)
55 func (p
*SubpSub
) testx() { println("SubpSub", p
, p
.a6
) }
66 func (p
*SubSubp
) test5() int {
68 println("SubpSub", p
, p
.a5
)
83 func (p
*SubSub
) test4() int {
85 println("SubpSub", p
, p
.a4
)
102 func (p
*Subp
) test3() int {
104 println("SubpSub", p
, p
.a3
)
121 func (p
*Sub
) test2() int {
123 println("SubpSub", p
, p
.a2
)
140 func (p
*S
) test1() int {
142 println("SubpSub", p
, p
.a1
)
159 s
.Sub
.SubSubp
= new(SubSubp
)
160 s
.Subp
.SubpSubp
= new(SubpSubp
)
162 // explicit assignment
169 s
.Subp
.SubpSubp
.a
= 7
171 // embedded (unique) assignment
180 // unique calls with explicit &
185 if (&s
.Sub
).test2() != 2 {
189 if s
.Subp
.test3() != 3 {
193 if (&s
.Sub
.SubSub
).test4() != 4 {
197 if s
.Sub
.SubSubp
.test5() != 5 {
201 if (&s
.Subp
.SubpSub
).test6() != 6 {
205 if s
.Subp
.SubpSubp
.test7() != 7 {
211 if s
.Sub
.test2() != 2 {
215 if s
.Sub
.SubSub
.test4() != 4 {
219 if s
.Subp
.SubpSub
.test6() != 6 {
225 if s
.test1() != s
.a1
{
229 if s
.test2() != s
.a2
{
233 if s
.test3() != s
.a3
{
237 if s
.test4() != s
.a4
{
241 if s
.test5() != s
.a5
{
245 if s
.test6() != s
.a6
{
249 if s
.test7() != s
.a7
{
254 // run it thru an interface
259 if s
.test1() != s
.a1
{
263 if s
.test2() != s
.a2
{
267 if s
.test3() != s
.a3
{
271 if s
.test4() != s
.a4
{
275 if s
.test5() != s
.a5
{
279 if s
.test6() != s
.a6
{
283 if s
.test7() != s
.a7
{
289 if i
.test1() != s
.test1() {
293 if i
.test2() != s
.test2() {
297 if i
.test3() != s
.test3() {
301 if i
.test4() != s
.test4() {
305 if i
.test5() != s
.test5() {
309 if i
.test6() != s
.test6() {
313 if i
.test7() != s
.test7() {