[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
[mono.git] / mcs / tests / test-pattern-04.cs
1 // Compiler options: -langversion:experimental
2
3 using System;
4
5 class RecursivePattern
6 {
7         static int Main ()
8         {
9                 object o = null;
10                 bool b = o is C1 (8);
11                 if (b)
12                         return 1;
13
14                 o = new C1 ();
15                 b = o is C1 (-4);
16                 if (b)
17                         return 2;
18
19                 b = o is C1 (8);
20                 if (!b)
21                         return 3;
22
23                 b = o is C1 (C1 (9), C1 (8));
24                 if (b)
25                         return 4;
26
27                 b = o is C1 (C1 (*), C1 (8));
28                 if (!b)
29                         return 41;
30
31                 b = o is C1 (0);
32                 if (b)
33                         return 5;
34
35                 ValueType vt = new S ();
36                 b = vt is S (null, 0);
37                 if (b)
38                         return 6;
39
40                 b = vt is S (8, 0);
41                 if (b)
42                         return 7;
43
44                 b = vt is S (8, 2);
45                 if (!b)
46                         return 8;
47
48                 Console.WriteLine ("ok");
49                 return 0;
50         }
51 }
52
53 class C1
54 {
55         public static bool operator is (C1 c, out int x)
56         {
57                 x = 8;
58                 return true;
59         }
60
61         public static bool operator is (C1 c, out C1 c2, out C1 c3)
62         {
63                 c2 = null;
64                 c3 = null;
65                 return true;
66         }
67 }
68
69 struct S
70 {
71         public static bool operator is (S s, out int? x, out decimal d)
72         {
73                 x = 8;
74                 d = 2;
75                 return true;
76         }
77 }