1 // Copyright 2016 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
18 T4 func(int, T0) chan T2
37 A14 = func(int, A0) chan A2
40 // check assignment compatibility due to equality of types
61 // alias receiver types
62 func (Ai /* ERROR "cannot define new methods on non-local type int" */) m1() {}
64 func (A0) m1 /* ERROR already declared */ () {}
66 func (A3 /* ERROR invalid receiver */ ) m1 () {}
67 func (A10 /* ERROR invalid receiver */ ) m1() {}
69 // x0 has methods m1, m2 declared via receiver type names T0 and A0
70 var _ interface{ m1(); m2() } = x0
72 // alias receiver types (test case for issue #23042)
78 _ interface{m()} = T{}
84 _ interface{m(); n()} = T{}
90 // alias receiver types (long type declaration chains)
98 func (V0) m /* ERROR already declared */ () {}
101 // alias receiver types (invalid due to cycles)
103 W0 /* ERROR invalid recursive type */ = W1
108 func (W0) m() {} // no error expected (due to above cycle error)
111 // alias receiver types (invalid due to builtin underlying type)
118 func (B0 /* ERROR cannot define new methods on non-local type int */ ) m() {}
119 func (B1 /* ERROR cannot define new methods on non-local type int */ ) n() {}
123 C2 /* ERROR invalid recursive type */ = C2
124 C3 /* ERROR invalid recursive type */ = C4
130 C7 /* ERROR invalid recursive type */ struct {
139 s1 struct { A0 } = s0 /* ERROR cannot use */ // embedded field names are different
142 // embedding and lookup of fields and methods
143 func _(s struct{A0}) { s.A0 = x0 }
145 type eX struct{xf int}
149 type eY = struct{eX} // field/method set of eY includes xf, xm
151 type eZ = *struct{eX} // field/method set of eZ includes xf, xm
154 eX // eX contributes xf, xm to eA
158 *eX // *eX contributes xf, xm to eA
162 eY // eY contributes xf, xm to eB
166 *eY // *eY contributes xf, xm to eB
170 eZ // eZ contributes xf, xm to eC
186 // ambiguous selectors due to embedding via type aliases
193 _ = eD{}.xf /* ERROR ambiguous selector eD{}.xf */
194 _ = eD{}.xm /* ERROR ambiguous selector eD{}.xm */
198 _ interface{ xm() } = eD /* ERROR missing method xm */ {}