In gmcs:
authorRaja R Harinath <harinath@hurrynot.org>
Wed, 25 Oct 2006 15:24:02 +0000 (15:24 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Wed, 25 Oct 2006 15:24:02 +0000 (15:24 -0000)
2006-10-25  Brian Crowell  <brian@fluggo.com>

Fix #79703
* generic.cs (CheckConstraints): Allow generic parameters with
inheritance constraints to satisfy reference type constraints.

In tests:
2006-10-25  Brian Crowell  <brian@fluggo.com>

* gtest-295.cs: New test from #79703.

svn path=/trunk/mcs/; revision=66954

mcs/gmcs/ChangeLog
mcs/gmcs/generic.cs
mcs/tests/ChangeLog
mcs/tests/gtest-295.cs [new file with mode: 0644]

index df7eefb6ef0feaadec52eae4a53ab81bfe0df248..e0dbd1dfc4c6f2ff8edd384c26d570d73f8db851 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-25  Brian Crowell  <brian@fluggo.com>
+
+       Fix #79703
+       * generic.cs (CheckConstraints): Allow generic parameters with
+       inheritance constraints to satisfy reference type constraints.
+
 2006-10-09  Martin Baulig  <martin@ximian.com>
 
        * generic.cs
index 579ab155868c7b0430e4050366fbb97d85fcb2c0..3e8cbc7e615e0a146160bfbca0f2202e9dafa799 100644 (file)
@@ -1549,8 +1549,8 @@ namespace Mono.CSharp {
                                if (agc != null) {
                                        if (agc is Constraints)
                                                ((Constraints) agc).Resolve (ec);
-                                       is_class = agc.HasReferenceTypeConstraint;
-                                       is_struct = agc.HasValueTypeConstraint;
+                                       is_class = agc.IsReferenceType;
+                                       is_struct = agc.IsValueType;
                                } else {
                                        is_class = is_struct = false;
                                }
index b713292d86f34f96181dda1a269c9f79cb8405e9..e573d3a8ceaecffecfe3eff972b580d5b0c1e2a9 100644 (file)
@@ -1,3 +1,7 @@
+2006-10-25  Brian Crowell  <brian@fluggo.com>
+
+       * gtest-295.cs: New test from #79703.
+
 2006-10-04  Martin Baulig  <martin@ximian.com>
 
        * known-issues-mcs, known-issues-gmcs: Updated the anonymous
diff --git a/mcs/tests/gtest-295.cs b/mcs/tests/gtest-295.cs
new file mode 100644 (file)
index 0000000..09a98cd
--- /dev/null
@@ -0,0 +1,13 @@
+namespace Test {
+    class Cache<T> where T : class {
+    }
+
+    class Base {
+    }
+
+    class MyType<T> where T : Base {
+        Cache<T> _cache;   // CS0452
+    }
+
+    class Foo { static void Main () { object foo = new MyType<Base> (); } }
+}