* ResolvedReference.cs (.ctor): Set 'OriginalItemSpec' and 'ResolvedFrom',
[mcs.git] / tests / gtest-448.cs
blobcd24648ff3504a13093ff790aedb2a50593090ff
1 // Compiler options: -langversion:future
3 using System;
4 using System.Runtime.InteropServices;
5 using System.Reflection;
7 public class C
9 public static void TestA ([Optional][DefaultParameterValue (1)] int u)
13 public static void TestB (long u = 12)
17 public static void TestC (decimal d = decimal.MaxValue)
21 public static int Main ()
23 ParameterInfo[] info = typeof (C).GetMethod ("TestA").GetParameters ();
25 if (info[0].DefaultValue.GetType () != typeof (int))
26 return 1;
28 if ((int) info[0].DefaultValue != 1)
29 return 2;
31 if (!info[0].IsOptional)
32 return 3;
34 info = typeof (C).GetMethod ("TestB").GetParameters ();
36 if (info[0].DefaultValue.GetType () != typeof (int))
37 return 11;
39 if ((int) info[0].DefaultValue != 12)
40 return 12;
42 if (!info[0].IsOptional)
43 return 13;
45 info = typeof (C).GetMethod ("TestC").GetParameters ();
47 if (info[0].DefaultValue.GetType () != typeof (decimal))
48 return 21;
50 if ((decimal) info[0].DefaultValue != decimal.MaxValue)
51 return 22;
53 if (!info[0].IsOptional)
54 return 23;
56 Console.WriteLine ("ok");
57 return 0;