diff options
author | Miguel de Icaza <miguel@gnome.org> | 2007-01-16 19:14:05 +0300 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2007-01-16 19:14:05 +0300 |
commit | 6c0f74f9d97707160f65e6da7cb4f2a63b214916 (patch) | |
tree | 2f70cf56486b706d9cf491b5fea762fd9720bb56 /mcs/tests/gtest-303.cs | |
parent | 16328a8db21ce3da7ec16a0c67382a173e229c9a (diff) |
2007-01-16 Sergey P. Kondratyev <se@unicom.tomica.ru>
* expression.cs (As.DoResolve): Use GenericConstraints instead of
Constraints, solves the problem where the compiler incorrectly
reported that a type parameter was not constrained to a class (Bug
80518)
2007-01-16 Sergey P. Kondratyev <se@unicom.tomica.ru>
* generic.cs (TypeParameter.FindMembers): Use the generic
constraints, not the constraints to check for methods (first fix
of 80518).
svn path=/trunk/mcs/; revision=71148
Diffstat (limited to 'mcs/tests/gtest-303.cs')
-rw-r--r-- | mcs/tests/gtest-303.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/mcs/tests/gtest-303.cs b/mcs/tests/gtest-303.cs new file mode 100644 index 00000000000..3f57bb33238 --- /dev/null +++ b/mcs/tests/gtest-303.cs @@ -0,0 +1,39 @@ +// +// Test case from bug 80518 +// + +using System; + +namespace test +{ + public class BaseClass + { + public BaseClass() + { + } + public string Hello { get { return "Hello"; } } + } + + public abstract class Printer + { + public abstract void Print<T>(T obj) where T: BaseClass; + } + + public class PrinterImpl : Printer + { + public override void Print<T>(T obj) + { + Console.WriteLine(obj.Hello); + } + } + + public class Starter + { + public static void Main( string[] args ) + { + BaseClass bc = new BaseClass(); + Printer p = new PrinterImpl(); + p.Print<BaseClass>(bc); + } + } +} |