[LoongArch64] Part-5:add loongarch support in some files for LoongArch64. (#21769)
[mono-project.git] / mcs / tests / test-pattern-04.cs
blobdff391cde5ab7d2a003cd7f8bfc0ed50cfb09201
1 // Compiler options: -langversion:experimental
3 using System;
5 class RecursivePattern
7 static int Main ()
9 object o = null;
10 bool b = o is C1 (8);
11 if (b)
12 return 1;
14 o = new C1 ();
15 b = o is C1 (-4);
16 if (b)
17 return 2;
19 b = o is C1 (8);
20 if (!b)
21 return 3;
23 b = o is C1 (C1 (9), C1 (8));
24 if (b)
25 return 4;
27 b = o is C1 (C1 (*), C1 (8));
28 if (!b)
29 return 41;
31 b = o is C1 (0);
32 if (b)
33 return 5;
35 ValueType vt = new S ();
36 b = vt is S (null, 0);
37 if (b)
38 return 6;
40 b = vt is S (8, 0);
41 if (b)
42 return 7;
44 b = vt is S (8, 2);
45 if (!b)
46 return 8;
48 Console.WriteLine ("ok");
49 return 0;
53 class C1
55 public static bool operator is (C1 c, out int x)
57 x = 8;
58 return true;
61 public static bool operator is (C1 c, out C1 c2, out C1 c3)
63 c2 = null;
64 c3 = null;
65 return true;
69 struct S
71 public static bool operator is (S s, out int? x, out decimal d)
73 x = 8;
74 d = 2;
75 return true;