Author: raja
Date: 2006-06-28 08:44:39 -0400 (Wed, 28 Jun 2006)
New Revision: 62111
Added:
trunk/mcs/tests/gtest-279.cs
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/generic.cs
trunk/mcs/tests/ChangeLog
Log:
Fix #78716
* gmcs/generic.cs (TypeManager.InferParamsTypeArguments): If there are
no arguments, return 'false': nothing can be inferred.
* tests/gtest-279.cs: New test from #78716.
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2006-06-28 12:18:48 UTC (rev 62110)
+++ trunk/mcs/gmcs/ChangeLog 2006-06-28 12:44:39 UTC (rev 62111)
@@ -1,3 +1,9 @@
+2006-06-28 Raja R Harinath <[EMAIL PROTECTED]>
+
+ Fix #78716
+ * generic.cs (TypeManager.InferParamsTypeArguments): If there are
+ no arguments, return 'false': nothing can be inferred.
+
2006-06-25 Marek Safar <[EMAIL PROTECTED]>
A fix for #78690
Modified: trunk/mcs/gmcs/generic.cs
===================================================================
--- trunk/mcs/gmcs/generic.cs 2006-06-28 12:18:48 UTC (rev 62110)
+++ trunk/mcs/gmcs/generic.cs 2006-06-28 12:44:39 UTC (rev 62111)
@@ -2482,31 +2482,25 @@
public static bool InferParamsTypeArguments (EmitContext ec,
ArrayList arguments,
ref MethodBase
method)
{
- if ((arguments == null) || !TypeManager.IsGenericMethod
(method))
+ if (!TypeManager.IsGenericMethod (method))
return true;
- int arg_count;
-
- if (arguments == null)
- arg_count = 0;
- else
- arg_count = arguments.Count;
-
- ParameterData pd = TypeManager.GetParameterData
(method);
+ // if there are no arguments, there's no way to infer
the type-arguments
+ if (arguments == null || arguments.Count == 0)
+ return false;
+ ParameterData pd = TypeManager.GetParameterData
(method);
int pd_count = pd.Count;
+ int arg_count = arguments.Count;
if (pd_count == 0)
return false;
-
+
if (pd.ParameterModifier (pd_count - 1) !=
Parameter.Modifier.PARAMS)
return false;
-
+
if (pd_count - 1 > arg_count)
return false;
-
- if (pd_count == 1 && arg_count == 0)
- return true;
Type[] method_args = method.GetGenericArguments ();
Type[] infered_types = new Type [method_args.Length];
Modified: trunk/mcs/tests/ChangeLog
===================================================================
--- trunk/mcs/tests/ChangeLog 2006-06-28 12:18:48 UTC (rev 62110)
+++ trunk/mcs/tests/ChangeLog 2006-06-28 12:44:39 UTC (rev 62111)
@@ -1,3 +1,7 @@
+2006-06-28 Raja R Harinath <[EMAIL PROTECTED]>
+
+ * gtest-279.cs: New test from #78716.
+
2006-06-21 Martin Baulig <[EMAIL PROTECTED]>
* test-anon-26.cs: Removed - this test case must not compile;
Added: trunk/mcs/tests/gtest-279.cs
===================================================================
--- trunk/mcs/tests/gtest-279.cs 2006-06-28 12:18:48 UTC (rev 62110)
+++ trunk/mcs/tests/gtest-279.cs 2006-06-28 12:44:39 UTC (rev 62111)
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+
+interface IFoo
+{
+ void Bar();
+ IList<T> Bar<T>();
+}
+
+class Foo : IFoo
+{
+ public void Bar()
+ {
+ Console.WriteLine("Bar");
+ }
+
+ public IList<T> Bar<T>()
+ {
+ Console.WriteLine("Bar<T>");
+ return null;
+ }
+}
+
+class BugReport
+{
+ static void Main(string[] args)
+ {
+ Foo f = new Foo();
+ f.Bar();
+ f.Bar<int>();
+ }
+}
+
+
Property changes on: trunk/mcs/tests/gtest-279.cs
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches