- Implemented InvokeGotFocus() method
[mono.git] / mcs / errors / error-1.cs
1 // This test must produce a compilation error in each method.
2 using System;
3
4 public class X
5 {
6         public static int Main ()
7         {
8                 // This is a compilation-only test.
9                 return 0;
10         }
11
12         // Must assign out parameter.
13         // CS0177
14         public static void test1 (out float f)
15         {
16         }
17
18         // Must assign it before returning.
19         public static void test2 (int a, out float f)
20         {
21                 // CS0177
22                 if (a == 5)
23                         return;
24
25                 f = 8.53F;
26         }
27
28         // CS0177
29         public static void test3 (out float f)
30         {
31                 try {
32                         f = 8.53F;
33                 } catch {
34                         return;
35                 }
36         }
37
38         public static int test4 ()
39         {
40                 int a;
41
42                 try {
43                         a = 3;
44                 } catch {
45                         Console.WriteLine ("EXCEPTION");
46                 }
47
48                 // CS0165
49                 return a;
50         }
51
52         public static int test5 ()
53         {
54                 int a;
55
56                 try {
57                         Console.WriteLine ("TRY");
58                         a = 8;
59                 } catch {
60                         a = 9;
61                 } finally {
62                         // CS0165
63                         Console.WriteLine (a);
64                 }
65
66                 return a;
67         }
68
69         public static void test6 (int a, out float f)
70         {
71                 do {
72                         // CS0177
73                         if (a == 8) {
74                                 Console.WriteLine ("Hello");
75                                 return;
76                         }
77                 } while (false);
78
79                 f = 1.3F;
80                 return;
81         }
82
83         // CS0177
84         public static void test7 (out float f)
85         {
86                 goto World;
87                 // warning CS0162
88                 f = 8.0F;
89
90         World:
91                 ;
92         }
93 }