diff options
author | Marek Safar <marek.safar@gmail.com> | 2012-11-10 18:30:45 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2012-11-10 18:37:52 +0400 |
commit | aa63004a73f9775e975f8d67b56cfdbbab101a72 (patch) | |
tree | 370cc12dbe7ecbd640981d07d02ffb158c607ad2 /mcs/tests/gtest-571.cs | |
parent | a0c72ab306d3c00801e2681a7e67490d9f06d232 (diff) |
Correctly check recursive constraints involving type parameters. Fixes #8232
Diffstat (limited to 'mcs/tests/gtest-571.cs')
-rw-r--r-- | mcs/tests/gtest-571.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/mcs/tests/gtest-571.cs b/mcs/tests/gtest-571.cs new file mode 100644 index 00000000000..75cd9a2a828 --- /dev/null +++ b/mcs/tests/gtest-571.cs @@ -0,0 +1,37 @@ +using System; + +public abstract class A<T> +{ + public abstract A<MM> For<MM> () where MM : T; +} + +public class B<U, X, V> : A<V> + where V : X + where X : U +{ + readonly A<U> _inner; + + public B (A<U> inner) + { + _inner = inner; + } + + public override A<PP> For<PP> () // base constraint is copied as PP : V + { + return _inner.For<PP> (); + } +} + +public class Test : A<Test> +{ + public static void Main () + { + var t = new Test (); + new B<Test, Test, Test> (t).For<Test> (); + } + + public override A<QQ> For<QQ> () + { + return null; + } +} |