3 // Copyright 2017 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.
11 // test case from issue #18395
16 C interface { D; F() A }
20 var _ = A(nil).G // G must be found
23 // test case from issue #21804
25 type sourceBridge interface {
26 listVersions() ([]Version, error)
29 type Constraint interface {
30 copyTo(*ConstraintMsg)
33 type ConstraintMsg struct{}
35 func (m *ConstraintMsg) asUnpairedVersion() UnpairedVersion {
39 type Version interface {
43 type UnpairedVersion interface {
47 var _ Constraint = UnpairedVersion(nil)
50 // derived test case from issue #21804
63 // derived test case from issue #22701
65 func F(x I4) interface{} {
69 type Unused interface {
91 // check embedding of error interface
93 type Error interface{ error }
99 // more esoteric cases
103 T2 /* ERROR "invalid recursive type" */ T2
108 T4 /* ERROR "invalid recursive type" */ T5
115 // arbitrary code may appear inside an interface
117 const n = unsafe.Sizeof(func(){})
120 m([unsafe.Sizeof(func() { I.m(nil, [n]byte{}) })]byte)
124 // test cases for varias alias cycles
126 type T10 /* ERROR "invalid recursive type" */ = *T10 // issue #25141
127 type T11 /* ERROR "invalid recursive type" */ = interface{ f(T11) } // issue #23139
140 c struct{ *b /* ERROR "invalid use of type alias" */ }
150 F() P // ERROR "invalid use of type alias"
159 type T12 /* ERROR "invalid recursive type" */ [len(a12)]int
160 var a12 = makeArray()
161 func makeArray() (res T12) { return }
164 var r /* ERROR "invalid cycle in declaration of r" */ = newReader()
167 // variations of the theme of #8699 and #20770
168 var arr /* ERROR "cycle" */ = f()
169 func f() [len(arr)]int
172 func ff(ff /* ERROR "not a type" */ )
173 func gg((gg /* ERROR "not a type" */ ))
175 type T13 /* ERROR "invalid recursive type T13" */ [len(b13)]int
178 func g1() [unsafe.Sizeof(g1)]int
179 func g2() [unsafe.Sizeof(x2)]int
182 // verify that we get the correct sizes for the functions above
183 // (note: assert is statically evaluated in go/types test mode)
185 assert(unsafe.Sizeof(g1) == 8)
186 assert(unsafe.Sizeof(x2) == 8)
189 func h() [h /* ERROR "no value" */ ()[0]]int { panic(0) }
191 var c14 /* ERROR "cycle" */ T14
192 type T14 [uintptr(unsafe.Sizeof(&c14))]byte
195 type T15 /* ERROR "invalid recursive type T15" */ struct {