]> git.ipfire.org Git - thirdparty/gcc.git/blob - libgo/go/go/typechecker/testdata/test0.go
Add Go frontend, libgo library, and Go testsuite.
[thirdparty/gcc.git] / libgo / go / go / typechecker / testdata / test0.go
1 // Copyright 2010 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.
4
5 // type declarations
6
7 package P0
8
9 type (
10 B bool
11 I int32
12 A [10]P
13 T struct {
14 x, y P
15 }
16 P *T
17 R *R
18 F func(A) I
19 Y interface {
20 f(A) I
21 }
22 S []P
23 M map[I]F
24 C chan<- I
25 )
26
27 type (
28 a/* ERROR "illegal cycle" */ a
29 a/* ERROR "already declared" */ int
30
31 b/* ERROR "illegal cycle" */ c
32 c d
33 d e
34 e b /* ERROR "not a type" */
35
36 t *t
37
38 U V
39 V W
40 W *U
41
42 P1 *S2
43 P2 P1
44
45 S1 struct {
46 a, b, c int
47 u, v, a/* ERROR "already declared" */ float
48 }
49 S2/* ERROR "illegal cycle" */ struct {
50 x S2
51 }
52
53 L1 []L1
54 L2 []int
55
56 A1 [10]int
57 A2/* ERROR "illegal cycle" */ [10]A2
58 A3/* ERROR "illegal cycle" */ [10]struct {
59 x A4
60 }
61 A4 [10]A3
62
63 F1 func()
64 F2 func(x, y, z float)
65 F3 func(x, y, x /* ERROR "already declared" */ float)
66 F4 func() (x, y, x /* ERROR "already declared" */ float)
67 F5 func(x int) (x /* ERROR "already declared" */ float)
68
69 I1 interface{}
70 I2 interface {
71 m1()
72 }
73 I3 interface {
74 m1()
75 m1 /* ERROR "already declared" */ ()
76 }
77 I4 interface {
78 m1(x, y, x /* ERROR "already declared" */ float)
79 m2() (x, y, x /* ERROR "already declared" */ float)
80 m3(x int) (x /* ERROR "already declared" */ float)
81 }
82 I5 interface {
83 m1(I5)
84 }
85
86 C1 chan int
87 C2 <-chan int
88 C3 chan<- C3
89
90 M1 map[Last]string
91 M2 map[string]M2
92
93 Last int
94 )