Author: marek
Date: 2008-02-04 08:30:34 -0500 (Mon, 04 Feb 2008)
New Revision: 94741

Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/generic.cs
Log:
2008-02-04  Marek Safar  <[EMAIL PROTECTED]>

        A fix for bug #355251
        * generic.cs: Added base class constraint based type inference.



Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2008-02-04 12:50:34 UTC (rev 94740)
+++ trunk/mcs/mcs/ChangeLog     2008-02-04 13:30:34 UTC (rev 94741)
@@ -1,3 +1,8 @@
+2008-02-04  Marek Safar  <[EMAIL PROTECTED]>
+
+       A fix for bug #355251
+       * generic.cs: Added base class constraint based type inference.
+
 2008-02-01  Marek Safar  <[EMAIL PROTECTED]>
 
        A fix for bug #357255

Modified: trunk/mcs/mcs/generic.cs
===================================================================
--- trunk/mcs/mcs/generic.cs    2008-02-04 12:50:34 UTC (rev 94740)
+++ trunk/mcs/mcs/generic.cs    2008-02-04 13:30:34 UTC (rev 94741)
@@ -2640,17 +2640,25 @@
 
                void AddToBounds (Type t, int index)
                {
-                       ArrayList a = bounds[index];
+                       ArrayList a = bounds [index];
                        if (a == null) {
                                a = new ArrayList ();
-                               a.Add (t);
-                               bounds[index] = a;
-                               return;
+                               bounds [index] = a;
+                       } else {
+                               if (a.Contains (t))
+                                       return;
                        }
 
-                       if (a.Contains (t))
-                               return;
-
+                       //
+                       // SPEC: does not cover type inference using constraints
+                       //
+                       if (TypeManager.IsGenericParameter (t)) {
+                               GenericConstraints constraints = 
TypeManager.GetTypeParameterConstraints (t);
+                               if (constraints != null) {
+                                       if (constraints.EffectiveBaseClass != 
null)
+                                               t = 
constraints.EffectiveBaseClass;
+                               }
+                       }
                        a.Add (t);
                }
                

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

Reply via email to