Author: martin
Date: 2006-06-16 13:14:16 -0400 (Fri, 16 Jun 2006)
New Revision: 61808

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

        * generic.cs
        (Constraints.InflatedConstraints.inflate): Correctly inflate
        generic types; fixes #78400.



Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2006-06-16 17:03:25 UTC (rev 61807)
+++ trunk/mcs/gmcs/ChangeLog    2006-06-16 17:14:16 UTC (rev 61808)
@@ -1,3 +1,9 @@
+2006-06-16  Martin Baulig  <[EMAIL PROTECTED]>
+
+       * generic.cs
+       (Constraints.InflatedConstraints.inflate): Correctly inflate
+       generic types; fixes #78400.
+
 2006-06-16  Juraj Skripsky  <[EMAIL PROTECTED]>
 
        * ecore.cs (SimpleName.Error_ObjectRefRequired): Do not truncate the 
name.

Modified: trunk/mcs/gmcs/generic.cs
===================================================================
--- trunk/mcs/gmcs/generic.cs   2006-06-16 17:03:25 UTC (rev 61807)
+++ trunk/mcs/gmcs/generic.cs   2006-06-16 17:14:16 UTC (rev 61808)
@@ -990,8 +990,14 @@
                                if (t.IsGenericParameter)
                                        return dargs 
[t.GenericParameterPosition];
                                if (t.IsGenericType) {
+                                       Type[] args = t.GetGenericArguments ();
+                                       Type[] inflated = new Type 
[args.Length];
+
+                                       for (int i = 0; i < args.Length; i++)
+                                               inflated [i] = inflate (args 
[i]);
+
                                        t = t.GetGenericTypeDefinition ();
-                                       t = t.MakeGenericType (dargs);
+                                       t = t.MakeGenericType (inflated);
                                }
 
                                return t;

Added: trunk/mcs/tests/gtest-271.cs
===================================================================
--- trunk/mcs/tests/gtest-271.cs        2006-06-16 17:03:25 UTC (rev 61807)
+++ trunk/mcs/tests/gtest-271.cs        2006-06-16 17:14:16 UTC (rev 61808)
@@ -0,0 +1,40 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+public class Qux<X,V> : IEnumerable<V>
+       where V : IComparable<V>
+{
+       public IEnumerator<V> GetEnumerator()
+       {
+               yield break;
+       }
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+               yield break;
+        }
+}
+
+public class Foo<X,V> : Qux<X,V>
+       where V : IComparable<V>
+{
+}
+
+public class Test<T> : IComparable<Test<T>>
+{
+       public int CompareTo (Test<T> t)
+       {
+               return 0;
+       }
+}
+
+class X
+{
+       static void Main ()
+       {
+               Foo<X,Test<X>> foo = new Foo<X,Test<X>> ();
+               foreach (Test<X> test in foo)
+                       ;
+       }
+}


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

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

Reply via email to