Enable 135 again
[mono.git] / mcs / tests / test-148.cs
index 8dca09c511f4ff1a1885b8174942cf787a59baea..61aa394433ca6f3f52cb63a1e66a57ad91456ae0 100644 (file)
@@ -1,4 +1,5 @@
 using System;
+using System.Collections;
 using System.Runtime.CompilerServices;
 
 public interface X
@@ -41,6 +42,13 @@ public class Z : Y
                }
        }
 
+       [IndexerName ("Whatever")]
+       public float this [long a, int b] {
+               get {
+                       return a / b;
+               }
+       }
+
        public int InstanceTest ()
        {
                double index = 5;
@@ -82,7 +90,45 @@ public class Z : Y
                if (y [index] != 3)
                        return 5;
 
-               return z.InstanceTest ();
+               int retval = z.InstanceTest ();
+               if (retval != 0)
+                       return retval;
+
+               B b = new B ();
+               if (b [4] != 16)
+                       return 8;
+               if (b [3,5] != 15)
+                       return 9;
+
+               D d = new D ();
+               if (d [4] != 16)
+                       return 10;
+               if (d [3,5] != 15)
+                       return 11;
+
+               //
+               // Now test for bug 35492
+               //
+               ChildList xd = new ChildList ();
+
+               xd.Add (0);
+               if (0 != (int)xd [0])
+                       return 12;
+               
+               xd.Test ();
+               if (1 != (int) xd [0])
+                       return 13;
+               
+               return 0;
+       }
+
+       class MyArray : ArrayList
+       {
+               public override object this[int index]
+               {
+                       get { return base[index]; }
+                       set { base[index] = value;}
+               }
        }
 
        public static int Main ()
@@ -91,6 +137,81 @@ public class Z : Y
 
                Console.WriteLine ("RESULT: " + result);
 
+               E e = new E ();
+               e.g = "monkey";
+
+               //
+               // Now test base [...]
+               //
+               MyArray arr = new MyArray ( );
+               arr.Add ( "String value" );
+               if (arr[0].ToString () != "String value")
+                       return 100;
+
                return result;
        }
+
+}
+
+public class A
+{
+       [IndexerName("Monkey")]
+       public int this [int value] {
+               get {
+                       return value * 4;
+               }
+       }
+}
+
+public class B : A
+{
+       public long this [long a, int value] {
+               get {
+                       return a * value;
+               }
+       }
+}
+
+public class C
+{
+       public int this [int value] {
+               get {
+                       return value * 4;
+               }
+       }
+}
+
+public class D : C
+{
+       public long this [long a, int value] {
+               get {
+                       return a * value;
+               }
+       }
+}
+
+public class E {
+       public virtual string g {
+               get { return "g"; }
+               set { }
+       }
+}
+
+public class F : E {
+       public override string g {
+               get { return "h"; }
+       }
 }
+
+public class DisposableNotifyList : ArrayList
+       {
+       }
+       
+public class ChildList : DisposableNotifyList
+    {
+               public void Test()
+               {
+                       base[0] = 1;
+
+               }
+    }