Author: raja
Date: 2008-02-20 02:56:26 -0500 (Wed, 20 Feb 2008)
New Revision: 96222
Added:
trunk/mcs/tests/gtest-371-lib.cs
trunk/mcs/tests/gtest-371.cs
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/typemanager.cs
Log:
* typemanager.cs (DropGenericMethodArguments): Ensure we get an underlying
MethodBuilder.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2008-02-20 07:16:39 UTC (rev 96221)
+++ trunk/mcs/mcs/ChangeLog 2008-02-20 07:56:26 UTC (rev 96222)
@@ -1,3 +1,8 @@
+2008-02-20 Raja R Harinath <[EMAIL PROTECTED]>
+
+ * typemanager.cs (DropGenericMethodArguments): Ensure we get an
underlying
+ MethodBuilder.
+
2008-02-19 Marek Safar <[EMAIL PROTECTED]>
* constant.cs, cfold.cs: SideEffectConstant results can apply for
folding.
Modified: trunk/mcs/mcs/typemanager.cs
===================================================================
--- trunk/mcs/mcs/typemanager.cs 2008-02-20 07:16:39 UTC (rev 96221)
+++ trunk/mcs/mcs/typemanager.cs 2008-02-20 07:56:26 UTC (rev 96222)
@@ -2834,14 +2834,14 @@
public static MethodBase DropGenericMethodArguments (MethodBase m)
{
#if GMCS_SOURCE
- if (m.IsGenericMethodDefinition)
- return m;
if (m.IsGenericMethod)
- return ((MethodInfo) m).GetGenericMethodDefinition ();
- if (!m.DeclaringType.IsGenericType)
+ m = ((MethodInfo) m).GetGenericMethodDefinition ();
+
+ Type t = m.DeclaringType;
+ if (!t.IsGenericType || t.IsGenericTypeDefinition)
return m;
- Type t = m.DeclaringType.GetGenericTypeDefinition ();
+ t = t.GetGenericTypeDefinition ();
BindingFlags bf = BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Static | BindingFlags.Instance |
BindingFlags.DeclaredOnly;
Added: trunk/mcs/tests/gtest-371-lib.cs
===================================================================
--- trunk/mcs/tests/gtest-371-lib.cs 2008-02-20 07:16:39 UTC (rev 96221)
+++ trunk/mcs/tests/gtest-371-lib.cs 2008-02-20 07:56:26 UTC (rev 96222)
@@ -0,0 +1,16 @@
+// Compiler options: -t:library
+
+public class Test<A,B>
+{
+ public void Foo<U> (U u)
+ { }
+
+ public void Foo<V> (V[] v, V w)
+ { }
+
+ public void Hello<V,W> (V v, W w, Test<V,W> x)
+ { }
+
+ public void ArrayMethod<V> (params V[] args)
+ { }
+}
Added: trunk/mcs/tests/gtest-371.cs
===================================================================
--- trunk/mcs/tests/gtest-371.cs 2008-02-20 07:16:39 UTC (rev 96221)
+++ trunk/mcs/tests/gtest-371.cs 2008-02-20 07:56:26 UTC (rev 96222)
@@ -0,0 +1,16 @@
+// Compiler options: -r:gtest-371-lib.dll
+
+// Important test: Type inference
+
+class X
+{
+ static void Main ()
+ {
+ Test<float,int> test = new Test<float,int> ();
+ test.Foo ("Hello World");
+ test.Foo (new long[] { 3, 4, 5 }, 9L);
+ test.Hello (3.14F, 9, test);
+ test.ArrayMethod (3.14F, (float) 9 / 3);
+ }
+}
+
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches