[ilasm] Don't break arguments compatiblity
[mono-project.git] / mcs / tests / gtest-optional-11.cs
blob85b035de657ec22183e07e72896d62cdf5272d4e
1 // Compiler options: -r:gtest-optional-11-lib.dll
3 using System;
4 using System.Reflection;
5 using System.Runtime.InteropServices;
7 public class C
9 public static int TestA ([Optional][DefaultParameterValue (1)] int u)
11 return u;
14 public static T TestB<T> (T a, [Optional] T u)
16 return u;
19 public static object TestC ([Optional] object a)
21 return a;
24 public static int TestD ([Optional] int a, int i)
26 return a;
29 public static int Main ()
31 if (TestA () != 1)
32 return 1;
34 if (TestB (-4) != 0)
35 return 2;
37 if (TestB ((object) null) != Missing.Value)
38 return 3;
40 if (TestC () != Missing.Value)
41 return 4;
43 if (TestD (i:2) != 0)
44 return 5;
46 if (Lib.TestA () != 1)
47 return 11;
49 if (Lib.TestB (-4) != 0)
50 return 12;
52 if (Lib.TestB ((object) null) != Missing.Value)
53 return 13;
55 if (Lib.TestC () != Missing.Value)
56 return 14;
58 if (Lib.TestC2 () != null)
59 return 15;
61 if (Lib.TestD (i:2) != 0)
62 return 16;
64 Lib.TestS ();
66 return 0;