1 // Copyright 2017 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.
9 // test case from issue #18395
14 C interface { D; F() A }
18 var _ = A(nil).G // G must be found
21 // test case from issue #21804
23 type sourceBridge interface {
24 listVersions() ([]Version, error)
27 type Constraint interface {
28 copyTo(*ConstraintMsg)
31 type ConstraintMsg struct{}
33 func (m *ConstraintMsg) asUnpairedVersion() UnpairedVersion {
37 type Version interface {
41 type UnpairedVersion interface {
45 var _ Constraint = UnpairedVersion(nil)
48 // derived test case from issue #21804
61 // derived test case from issue #22701
63 func F(x I4) interface{} {
67 type Unused interface {
89 // check embedding of error interface
91 type Error interface{ error }
97 // more esoteric cases
101 T2 /* ERROR "invalid recursive type" */ T2
106 T4 /* ERROR "invalid recursive type" */ T5
113 // arbitrary code may appear inside an interface
115 const n = unsafe.Sizeof(func(){})
118 m([unsafe.Sizeof(func() { I.m(nil, [n]byte{}) })]byte)
122 // test cases for varias alias cycles
124 type T10 /* ERROR "invalid recursive type" */ = *T10 // issue #25141
125 type T11 /* ERROR "invalid recursive type" */ = interface{ f(T11) } // issue #23139
138 c struct{ *b /* ERROR "invalid use of type alias" */ }
148 F() P // ERROR "invalid use of type alias"
157 type T12 /* ERROR "invalid recursive type" */ [len(a12)]int
158 var a12 = makeArray()
159 func makeArray() (res T12) { return }
162 var r /* ERROR "invalid cycle in declaration of r" */ = newReader()
165 // variations of the theme of #8699 and #20770
166 var arr /* ERROR "cycle" */ = f()
167 func f() [len(arr)]int
170 func ff(ff /* ERROR "not a type" */ )
171 func gg((gg /* ERROR "not a type" */ ))
173 type T13 /* ERROR "invalid recursive type T13" */ [len(b13)]int
176 func g1() [unsafe.Sizeof(g1)]int
177 func g2() [unsafe.Sizeof(x2)]int
180 // verify that we get the correct sizes for the functions above
181 // (note: assert is statically evaluated in go/types test mode)
183 assert(unsafe.Sizeof(g1) == 8)
184 assert(unsafe.Sizeof(x2) == 8)
187 func h() [h /* ERROR "no value" */ ()[0]]int { panic(0) }
189 var c14 /* ERROR "cycle" */ T14
190 type T14 [uintptr(unsafe.Sizeof(&c14))]byte
193 type T15 /* ERROR "invalid recursive type T15" */ struct {