2007-03-15 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Thu, 15 Mar 2007 14:25:30 +0000 (14:25 -0000)
committerMartin Baulig <martin@novell.com>
Thu, 15 Mar 2007 14:25:30 +0000 (14:25 -0000)
Fix #80731.

* decl.cs (DeclSpace): If we're a partial class, use our
`PartialContainer's `TypeParameters' and `CurrentTypeParameters'.

svn path=/trunk/mcs/; revision=74367

mcs/mcs/ChangeLog
mcs/mcs/decl.cs
mcs/tests/gtest-315.cs [new file with mode: 0644]

index a803a1047c8ab6051be1ee03298158b90f14c494..a94c6dd3d57665e0d7bbeb27a06b8a0a2a666912 100644 (file)
@@ -6,6 +6,13 @@
        (FlowBranching.MergeSiblings): Likewise.
        * statement.cs: Likewise.
 
+2007-03-15  Martin Baulig  <martin@ximian.com>
+
+       Fix #80731.
+
+       * decl.cs (DeclSpace): If we're a partial class, use our
+       `PartialContainer's `TypeParameters' and `CurrentTypeParameters'.
+
 2007-03-15  Martin Baulig  <martin@ximian.com>
 
        Fix #79302.
index 413eba518117fbf00d115f9d20286acdce5d346c..b27ad5755685726db560fb89ec016278900a19bd 100644 (file)
@@ -1254,6 +1254,8 @@ namespace Mono.CSharp {
                        get {
                                if (!IsGeneric)
                                        throw new InvalidOperationException ();
+                               if ((PartialContainer != null) && (PartialContainer != this))
+                                       return PartialContainer.TypeParameters;
                                if (type_param_list == null)
                                        initialize_type_params ();
 
@@ -1265,6 +1267,8 @@ namespace Mono.CSharp {
                        get {
                                if (!IsGeneric)
                                        throw new InvalidOperationException ();
+                               if ((PartialContainer != null) && (PartialContainer != this))
+                                       return PartialContainer.CurrentTypeParameters;
                                if (type_params != null)
                                        return type_params;
                                else
diff --git a/mcs/tests/gtest-315.cs b/mcs/tests/gtest-315.cs
new file mode 100644 (file)
index 0000000..3d4afe4
--- /dev/null
@@ -0,0 +1,19 @@
+// Bug #80731
+public partial class A<T>
+{
+       public class B {}
+}
+
+public partial class A<T>
+{
+       public B Test;
+}
+
+class X
+{
+       static void Main ()
+       {
+               A<int> a = new A<int> ();
+               a.Test = new A<int>.B ();
+       }
+}