Author: martin
Date: 2006-07-21 09:34:49 -0400 (Fri, 21 Jul 2006)
New Revision: 62858

Added:
   trunk/mcs/tests/gtest-281.cs
Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/generic.cs
Log:
2006-07-21  Martin Baulig  <[EMAIL PROTECTED]>

        * generic.cs (TypeManager.InferType): When inferring an array
        type, also allow IList<T> and ICollection<T>.  Fixes #78900.



Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2006-07-21 13:04:43 UTC (rev 62857)
+++ trunk/mcs/gmcs/ChangeLog    2006-07-21 13:34:49 UTC (rev 62858)
@@ -1,5 +1,10 @@
 2006-07-21  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * generic.cs (TypeManager.InferType): When inferring an array
+       type, also allow IList<T> and ICollection<T>.  Fixes #78900.
+
+2006-07-21  Martin Baulig  <[EMAIL PROTECTED]>
+
        * generic.cs (TypeManager.IsIEnumerable): Renamed into IsIList()
        and allow IList`1 and all its base interfaces.
 

Modified: trunk/mcs/gmcs/generic.cs
===================================================================
--- trunk/mcs/gmcs/generic.cs   2006-07-21 13:04:43 UTC (rev 62857)
+++ trunk/mcs/gmcs/generic.cs   2006-07-21 13:34:49 UTC (rev 62858)
@@ -2407,10 +2407,14 @@
                                        return InferType (pt.GetElementType (), 
at.GetElementType (), infered);
                                }
 
-                               if (!pt.IsGenericType ||
-                                   (pt.GetGenericTypeDefinition () != 
generic_ienumerable_type))
-                                   return false;
+                               if (!pt.IsGenericType)
+                                       return false;
 
+                               Type gt = pt.GetGenericTypeDefinition ();
+                               if ((gt != generic_ilist_type) && (gt != 
generic_icollection_type) &&
+                                   (gt != generic_ienumerable_type))
+                                       return false;
+
                                Type[] args = GetTypeArguments (pt);
                                return InferType (args [0], at.GetElementType 
(), infered);
                        }

Added: trunk/mcs/tests/gtest-281.cs
===================================================================
--- trunk/mcs/tests/gtest-281.cs        2006-07-21 13:04:43 UTC (rev 62857)
+++ trunk/mcs/tests/gtest-281.cs        2006-07-21 13:34:49 UTC (rev 62858)
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+
+public class List {
+        internal void AddRange<T>(ICollection<T> otherList) {
+        }
+}
+
+public class Tests
+{
+       public static void Main ()
+       {
+               object[] args = new object [0];
+               List l = new List ();
+               l.AddRange (args);
+       }
+}


Property changes on: trunk/mcs/tests/gtest-281.cs
___________________________________________________________________
Name: svn:executable
   + *

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to