Check type parameter substitutions for nested interfaces as well
authorMarek Safar <marek.safar@gmail.com>
Mon, 31 Oct 2011 09:02:46 +0000 (09:02 +0000)
committerMarek Safar <marek.safar@gmail.com>
Wed, 2 Nov 2011 11:09:48 +0000 (11:09 +0000)
mcs/errors/cs0695-6.cs [new file with mode: 0644]
mcs/mcs/class.cs

diff --git a/mcs/errors/cs0695-6.cs b/mcs/errors/cs0695-6.cs
new file mode 100644 (file)
index 0000000..26721c1
--- /dev/null
@@ -0,0 +1,20 @@
+// CS0695: `Test<T>.TestN' cannot implement both `C<T>.I' and `C<string>.I' because they may unify for some type parameter substitutions
+// Line: 17
+
+class C<T>
+{
+       public interface I
+       {
+       }
+       
+       public class N : C<string>
+       {
+       }
+}
+
+class Test<T> : C<T>
+{
+       class TestN : I, N.I
+       {
+       }
+}
index 92e8febbe0e77e487bc184585a387cc569d9db66..d06b8bde135fe8f67375bf04b88f164cd15c2674 100644 (file)
@@ -1558,7 +1558,9 @@ namespace Mono.CSharp
                                                                GetSignatureForError (), iface_type.GetSignatureForError ());
                                                        return false;
                                                }
+                                       }
 
+                                       if (iface_type.IsGenericOrParentIsGeneric) {
                                                if (spec.Interfaces != null) {
                                                        foreach (var prev_iface in iface_exprs) {
                                                                if (prev_iface == iface_type)