Initial set of Ward sgen annotations (#5705)
[mono.git] / mcs / tests / test-162.cs
1 using System;
2
3 struct A
4 {
5         public int a;
6         private long b;
7         private float c;
8
9         public A (int foo)
10         {
11                 a = foo;
12                 b = 8;
13                 c = 9.0F;
14         }
15 }
16
17 struct B
18 {
19         public int a;
20 }
21
22 struct C
23 {
24         public long b;
25
26         public C (long foo)
27         {
28                 b = foo;
29         }
30
31         // has `this' initializer, no need to initialize fields.
32         public C (string foo)
33                 : this (500)
34         { }
35 }
36
37 struct D
38 {
39         public int foo;
40 }
41
42 struct E
43 {
44         public D d;
45         public bool e;
46
47         public E (int foo)
48         {
49                 this.e = true;
50                 this.d.foo = 9;
51         }
52 }
53
54 struct F
55 {
56         public E e;
57         public float f;
58 }
59
60 class X
61 {
62         static void test_output (A x)
63         { }
64
65         static void test_output (B y)
66         { }
67
68         static void test_output (E e)
69         { }
70
71         static void test_output (F f)
72         { }
73
74         static void test1 ()
75         {
76                 A x;
77
78                 x.a = 5;
79                 Console.WriteLine (x.a);
80         }
81
82         static void test2 ()
83         {
84                 B y;
85
86                 y.a = 5;
87                 Console.WriteLine (y.a);
88                 Console.WriteLine (y);
89         }
90
91         static void test3 ()
92         {
93                 A x = new A (85);
94
95                 Console.WriteLine (x);
96         }
97
98         static void test4 (A x)
99         {
100                 x.a = 5;
101         }
102
103         static void test5 (out A x)
104         {
105                 x = new A (85);
106         }
107
108         static void test6 (out B y)
109         {
110                 y.a = 1;
111         }
112
113         static void test7 ()
114         {
115                 E e;
116                 e.e = true;
117                 e.d.foo = 5;
118
119                 test_output (e);
120         }
121
122         static void test8 ()
123         {
124                 F f;
125                 f.e.e = true;
126                 f.e.d.foo = 5;
127                 f.f = 3.14F;
128
129                 test_output (f);
130         }
131
132         static void test9 ()
133         {
134                 E e = new E (5);
135                 Console.WriteLine (e.d.foo);
136         }
137
138         static void test10 ()
139         {
140                 F f;
141                 f.e = new E (10);
142                 Console.WriteLine (f.e.d.foo);
143                 Console.WriteLine (f.e.d);
144                 f.f = 3.14F;
145                 Console.WriteLine (f);
146         }
147
148         public static int Main ()
149         {
150                 // Compilation-only test.
151                 return 0;
152         }
153 }