Lazy initialization of type parameters expanded interfaces. Fixes #13324
authorMarek Safar <marek.safar@gmail.com>
Sat, 20 Jul 2013 06:52:23 +0000 (08:52 +0200)
committerMarek Safar <marek.safar@gmail.com>
Sat, 20 Jul 2013 07:18:57 +0000 (09:18 +0200)
mcs/mcs/generic.cs
mcs/tests/gtest-partial-09.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_5.xml

index 88771a8d4e196e74d8917da5157a27aead7b88a5..2fa6bb03157cf8d74deadd5af9737279bc88593e 100644 (file)
@@ -511,7 +511,7 @@ namespace Mono.CSharp {
 
                        // Copy constraint from resolved part to partial container
                        spec.SpecialConstraint = tp.spec.SpecialConstraint;
-                       spec.Interfaces = tp.spec.Interfaces;
+                       spec.InterfacesDefined = tp.spec.InterfacesDefined;
                        spec.TypeArguments = tp.spec.TypeArguments;
                        spec.BaseType = tp.spec.BaseType;
                        
@@ -2494,8 +2494,8 @@ namespace Mono.CSharp {
                        //
                        // Check the interfaces constraints
                        //
-                       if (tparam.Interfaces != null) {
-                               foreach (TypeSpec iface in tparam.Interfaces) {
+                       if (tparam.InterfacesDefined != null) {
+                               foreach (TypeSpec iface in tparam.InterfacesDefined) {
                                        if (!CheckConversion (mc, context, atype, tparam, iface, loc)) {
                                                if (mc == null)
                                                        return false;
diff --git a/mcs/tests/gtest-partial-09.cs b/mcs/tests/gtest-partial-09.cs
new file mode 100644 (file)
index 0000000..2dbb116
--- /dev/null
@@ -0,0 +1,57 @@
+namespace A
+{
+       public partial class B<T>
+       {
+               public partial class C
+               {
+                       public class A { }
+               }
+       }
+}
+
+namespace A
+{
+       public abstract partial class B<T> where T : B<T>.C
+       {
+       }
+}
+
+namespace A
+{
+       public partial class B<T>
+       {
+               public partial class C : I
+               {
+               }
+       }
+}
+
+namespace A
+{
+       public interface Ibase
+       {
+       }
+
+       public partial class B<T>
+       {
+               public interface I : Ibase
+               {
+               }
+       }
+}
+
+namespace A
+{
+       class Bar : B<Bar>.C
+       {
+       }
+
+       public class Test
+       {
+               public static void Main ()
+               {
+                       Ibase b = new Bar ();
+                       System.Console.WriteLine (b != null);
+               }
+       }
+}
index 48fc25c543a3752715be14d590b51bfee57325f9..aa91c26a8950fd59c7d5b3c586a3e5a5b35af750 100644 (file)
       </method>\r
     </type>\r
   </test>\r
+  <test name="gtest-partial-09.cs">\r
+    <type name="A.B`1[T]">\r
+      <method name="Void .ctor()" attrs="6276">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="A.B`1+C[T]">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="A.B`1+C+A[T]">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="A.Bar">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="A.Test">\r
+      <method name="Void Main()" attrs="150">\r
+        <size>20</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="gtest-var-04.cs">\r
     <type name="Test">\r
       <method name="Int32 Main()" attrs="150">\r