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:
authorMarek Safar <marek.safar@gmail.com>2010-10-21 19:01:19 +0400
committerMarek Safar <marek.safar@gmail.com>2010-10-21 19:07:48 +0400
commit46dd735d7fe6532867683ecedd65fbda375c2306 (patch)
tree0605cc853acb38b8dd6e27f758384bb0b81b5f61 /mcs/tests/dtest-039.cs
parent30f3fd3434ceb7b81d0259ecd1d37071458f4c34 (diff)
Implement closest override return type matching
Diffstat (limited to 'mcs/tests/dtest-039.cs')
-rw-r--r--mcs/tests/dtest-039.cs102
1 files changed, 102 insertions, 0 deletions
diff --git a/mcs/tests/dtest-039.cs b/mcs/tests/dtest-039.cs
new file mode 100644
index 00000000000..1535710bc3e
--- /dev/null
+++ b/mcs/tests/dtest-039.cs
@@ -0,0 +1,102 @@
+class A
+{
+ public virtual object Foo ()
+ {
+ return null;
+ }
+
+ public virtual object[] FooArray ()
+ {
+ return null;
+ }
+
+ internal virtual object Prop {
+ get {
+ return 9;
+ }
+ set {
+ }
+ }
+
+ public virtual object[] PropArray {
+ get {
+ return null;
+ }
+ }
+
+ internal virtual object this [int arg] {
+ get {
+ return 5;
+ }
+ set {
+ }
+ }
+}
+
+class B : A
+{
+ public override dynamic Foo ()
+ {
+ return 5;
+ }
+
+ public override dynamic[] FooArray ()
+ {
+ return new object [] { 'a', 'b' , 'z' };
+ }
+
+ internal override dynamic Prop {
+ set {
+ }
+ }
+
+ public override dynamic[] PropArray {
+ get {
+ return new object [] { 'a', 'b' };
+ }
+ }
+
+ internal override dynamic this [int arg] {
+ set {
+ }
+ }
+}
+
+class MainClass : B
+{
+ void Test ()
+ {
+ char ch;
+ ch = Prop;
+ ch = PropArray [1];
+ ch = this [1];
+ }
+
+ public static int Main ()
+ {
+ B b = new B ();
+ int res;
+ res = b.Foo ();
+ if (res != 5)
+ return 1;
+
+ char ch = b.FooArray () [1];
+ if (ch != 'b')
+ return 2;
+
+ ++b.Prop;
+ res = b.Prop;
+ if (res != 9)
+ return 3;
+
+ ch = b.PropArray [1];
+ if (ch != 'b')
+ return 4;
+
+ res = b [3];
+ if (res != 5)
+ return 5;
+
+ return 0;
+ }
+} \ No newline at end of file