[ilasm] Don't break arguments compatiblity
[mono-project.git] / mcs / tests / gtest-optional-13.cs
blobb351c0fcd945317bb3f10ae2b03b46d1afcc501b
1 using System;
3 class A
5 public virtual int Foo (int i)
7 return i;
10 public virtual int Foo2 (int i = 99)
12 return i;
15 public virtual int this[string s, int arg] {
16 get {
17 return arg;
22 class B : A
24 public override int Foo (int i2 = 4)
26 return i2 + 1;
29 public new int Foo2 (int i)
31 return 77;
34 public override int this[string s, int arg2 = 9] {
35 get {
36 return arg2 + 1;
41 class C
43 public static int Main ()
45 B b = new B ();
46 int i = b.Foo ();
47 if (i != 5)
48 return 1;
50 i = b.Foo (i2: 3);
51 if (i != 4)
52 return 2;
54 i = b["a"];
55 if (i != 10)
56 return 3;
58 i = b["a", arg2: 20];
59 if (i != 21)
60 return 4;
62 i = b.Foo2 ();
63 if (i != 99)
64 return 5;
66 i = b.Foo2 (i : 8);
67 if (i != 77)
68 return 6;
70 Console.WriteLine ("ok");
71 return 0;