Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <martin@novell.com>2002-07-23 02:40:42 +0400
committerMartin Baulig <martin@novell.com>2002-07-23 02:40:42 +0400
commitd78d8fcf4862b199ad2b89126c65e23482e32471 (patch)
tree49335cef9a59fa90a5f90ec1c56c2c6e5b3b087b /mcs/tests/test-148.cs
parentefd63e13587d00f688406802345d83632ff582d6 (diff)
2002-07-23 Martin Baulig <martin@gnome.org>
* test-148.cs: New test. svn path=/trunk/mcs/; revision=6032
Diffstat (limited to 'mcs/tests/test-148.cs')
-rw-r--r--mcs/tests/test-148.cs82
1 files changed, 82 insertions, 0 deletions
diff --git a/mcs/tests/test-148.cs b/mcs/tests/test-148.cs
new file mode 100644
index 00000000000..5c29fe1322a
--- /dev/null
+++ b/mcs/tests/test-148.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Runtime.CompilerServices;
+
+public interface X
+{
+ [IndexerName ("Foo")]
+ int this [int a] {
+ get;
+ }
+}
+
+public class Y : X
+{
+ int X.this [int a] {
+ get {
+ return 1;
+ }
+ }
+
+ [IndexerName ("Bar")]
+ public int this [int a] {
+ get {
+ return 2;
+ }
+ }
+
+ [IndexerName ("Bar")]
+ public long this [double a] {
+ get {
+ return 3;
+ }
+ }
+}
+
+public class Z : Y
+{
+ [IndexerName ("Whatever")]
+ new public long this [double a] {
+ get {
+ return 4;
+ }
+ }
+
+ public static int Test ()
+ {
+ Z z = new Z ();
+ X x = (X) z;
+ Y y = (Y) z;
+
+ Console.WriteLine (z [1]);
+ Console.WriteLine (y [2]);
+ Console.WriteLine (x [3]);
+
+ if (z [1] != 4)
+ return 1;
+ if (y [1] != 2)
+ return 2;
+ if (x [1] != 1)
+ return 3;
+
+ double index = 5;
+
+ Console.WriteLine (z [index]);
+ Console.WriteLine (y [index]);
+
+ if (z [index] != 4)
+ return 4;
+ if (y [index] != 3)
+ return 5;
+
+ return 0;
+ }
+
+ public static int Main ()
+ {
+ int result = Test ();
+
+ Console.WriteLine ("RESULT: " + result);
+
+ return result;
+ }
+}