diff options
author | Marek Safar <marek.safar@gmail.com> | 2010-10-21 19:01:19 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2010-10-21 19:07:48 +0400 |
commit | 46dd735d7fe6532867683ecedd65fbda375c2306 (patch) | |
tree | 0605cc853acb38b8dd6e27f758384bb0b81b5f61 /mcs/tests/dtest-040.cs | |
parent | 30f3fd3434ceb7b81d0259ecd1d37071458f4c34 (diff) |
Implement closest override return type matching
Diffstat (limited to 'mcs/tests/dtest-040.cs')
-rw-r--r-- | mcs/tests/dtest-040.cs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/mcs/tests/dtest-040.cs b/mcs/tests/dtest-040.cs new file mode 100644 index 00000000000..5cfa4e915d6 --- /dev/null +++ b/mcs/tests/dtest-040.cs @@ -0,0 +1,52 @@ +struct S<T1, T2> +{ + public T1 First; + public T2 Second; +} + +class A +{ + public virtual S<U, object> Foo<U> (U u) + { + return new S<U, object> (); + } +} + +class B : A +{ + public override S<T, dynamic> Foo<T> (T t) + { + return new S<T, dynamic> () { + First = t, + Second = "second" + }; + } +} + +public class MainClass +{ + public static int Main () + { + B b = new B (); + var res = b.Foo<int> (5); + int i; + i = res.First; + if (i != 5) + return 1; + + i = res.Second.Length; + if (i != 6) + return 2; + + res = b.Foo (4); + i = res.First; + if (i != 4) + return 3; + + i = res.Second.Length; + if (i != 6) + return 4; + + return 0; + } +}
\ No newline at end of file |