[mcs] Check for nested type arguments of cached method group. Fixes #17403
authorMarek Safar <marek.safar@gmail.com>
Fri, 24 Jan 2014 16:53:21 +0000 (17:53 +0100)
committerMarek Safar <marek.safar@gmail.com>
Sun, 26 Jan 2014 10:35:08 +0000 (11:35 +0100)
mcs/mcs/delegate.cs
mcs/tests/test-884.cs [new file with mode: 0644]

index 21854b19ff051685338f18527b18627c8eef8c82..326c4b7e8adb3cc51f28a20fb7244cfc5cdd8203 100644 (file)
@@ -679,6 +679,9 @@ namespace Mono.CSharp {
                                }
                        }
 
+                       if (type.IsNested)
+                               return ContainsMethodTypeParameter (type.DeclaringType);
+
                        return false;
                }
                
diff --git a/mcs/tests/test-884.cs b/mcs/tests/test-884.cs
new file mode 100644 (file)
index 0000000..50519a7
--- /dev/null
@@ -0,0 +1,27 @@
+// Compiler options: -optimize
+
+using System;
+
+class C
+{
+       static void Main ()
+       {
+               AddEH<string> ();
+       }
+
+       static void AddEH<T>()
+       {
+               var e = new E<T> ();
+               e.EEvent += EHandler;
+       }
+
+       static void EHandler ()
+       {
+       }
+
+       class E<T>
+       {
+               public delegate void EMethod ();
+               public event EMethod EEvent;
+       }
+}
\ No newline at end of file