2006-09-01 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Fri, 1 Sep 2006 16:52:08 +0000 (16:52 -0000)
committerMartin Baulig <martin@novell.com>
Fri, 1 Sep 2006 16:52:08 +0000 (16:52 -0000)
* generic.cs
(TypeManager.IsIList): Also handle base classes and interfaces.

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

mcs/gmcs/ChangeLog
mcs/gmcs/generic.cs

index 64f902e6b35f5ef4164ed0762d01cf932b5e5137..88857854eac56083fb2c2cf18545d77bd9862fe7 100644 (file)
@@ -1,3 +1,8 @@
+2006-09-01  Martin Baulig  <martin@ximian.com>
+
+       * generic.cs
+       (TypeManager.IsIList): Also handle base classes and interfaces. 
+
 2006-09-01  Raja R Harinath  <rharinath@novell.com>
 
        Fix #79238
index 08d12b16e16cadd740c651f91e25de149c1d3f2d..440b2d034559727b1acc6c0c6fbf5aad1f5b292b 100644 (file)
@@ -2117,8 +2117,24 @@ namespace Mono.CSharp {
                            (gt != generic_ienumerable_type))
                                return false;
 
-                       Type[] args = GetTypeArguments (list);
-                       return args [0] == GetElementType (array);
+                       Type arg_type = GetTypeArguments (list) [0];
+                       Type element_type = GetElementType (array);
+
+                       if (arg_type == element_type)
+                               return true;
+                       else if (element_type.IsValueType)
+                               return false;
+
+                       while (element_type != null) {
+                               if (arg_type == element_type)
+                                       return true;
+                               foreach (Type iface in element_type.GetInterfaces ())
+                                       if (arg_type == iface)
+                                               return true;
+                               element_type = element_type.BaseType;
+                       }
+
+                       return false;
                }
 
                public static bool IsEqual (Type a, Type b)