[ilasm] Don't break arguments compatiblity
[mono-project.git] / mcs / tests / test-pattern-06.cs
blob335f075e997d785da861d1ce380f73d072d4801f
1 // Compiler options: -langversion:experimental
3 using System;
5 class RecursiveNamedPattern
7 public static int Main ()
9 if (Switch_1 (null) != 4)
10 return 1;
12 if (Switch_1 ("x") != 5)
13 return 2;
15 if (Switch_1 (1) != 1)
16 return 3;
18 // if (Switch_1 (new C1 ()) != 3)
19 // return 4;
21 if (Switch_1 ((byte?) 1) != 1)
22 return 5;
24 if (Switch_2 (new C1 ()) != 3)
25 return 10;
27 if (Switch_2 (null) != 2)
28 return 11;
30 Console.WriteLine ("ok");
31 return 0;
34 static int Switch_1 (object o)
36 switch (o) {
37 case 1:
38 return 1;
39 // case C1 (3):
40 // return 2;
41 // case C1 (2):
42 // return 3;
43 case null:
44 return 4;
45 default:
46 return 5;
50 static int Switch_2 (C1 o)
52 switch (o) {
53 case null:
54 return 2;
57 return 3;
61 public class C1
63 public static bool operator is (C1 c1, out int i)
65 i = 2;
66 return true;