GenericParameter.cs: override Module properly
[mcs.git] / tests / test-named-02.cs
blob346ebe7b1f09b650c4de2b8d2c61b61352a59507
1 // Compiler options: -langversion:future
3 using System;
5 class A
7 public int id;
9 public int this [int i] {
10 set { Console.WriteLine ("set= " + i); id = value; }
11 get { Console.WriteLine ("get= " + i); return id; }
15 struct MyPoint
17 public MyPoint (int x, int y)
19 X = x;
20 Y = y;
23 public int X, Y;
26 class C
28 static decimal Foo (decimal t, decimal a)
30 return a;
33 static string Bar (int a = 1, string s = "2", char c = '3')
35 return a.ToString () + s + c;
38 static int Test (int a, int b)
40 Console.WriteLine ("{0} {1}", a, b);
41 return a * 3 + b * 7;
44 public static int Main ()
46 int h;
47 if (Foo (a : h = 9, t : 3) != 9)
48 return 1;
50 if (h != 9)
51 return 2;
53 if (Bar (a : 1, s : "x", c : '2') != "1x2")
54 return 3;
56 if (Bar (s : "x") != "1x3")
57 return 4;
59 int i = 1;
60 if (Test (a: i++, b: i++) != 17)
61 return 5;
63 if (i != 3)
64 return 6;
66 i = 1;
67 if (Test (b: i++, a: i++) != 13)
68 return 7;
70 A a = new A ();
71 i = 5;
72 a [i:i++]++;
74 if (a.id != 1)
75 return 8;
77 if (i != 6)
78 return 9;
80 MyPoint mp = new MyPoint (y : -1, x : 5);
81 if (mp.Y != -1)
82 return 10;
84 Console.WriteLine ("ok");
85 return 0;