Author: martin
Date: 2005-04-12 16:57:36 -0400 (Tue, 12 Apr 2005)
New Revision: 42875
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/delegate.cs
trunk/mcs/gmcs/expression.cs
Log:
**** Merged r40996 from MCS ****
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2005-04-12 20:52:59 UTC (rev 42874)
+++ trunk/mcs/gmcs/ChangeLog 2005-04-12 20:57:36 UTC (rev 42875)
@@ -6,6 +6,22 @@
2005-02-21 Raja R Harinath <[EMAIL PROTECTED]>
+ Fix #68955.
+ * expression.cs (Invocation.IsApplicable): Make public.
+ (Invocation.IsParamsMethodApplicable): Likewise.
+ * delegate.cs (Delegate.VerifyApplicability): Don't use
+ Invocation.VerifyArgumentCompat for parameter applicability
+ testing. Use Invocation.IsApplicable and
+ Invocation.IsParamsMethodApplicable.
+
+2005-02-21 Marek Safar <[EMAIL PROTECTED]>
+
+ * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
+
+ * class.cs (Operator.Define): Add error 217 report.
+
+2005-02-21 Raja R Harinath <[EMAIL PROTECTED]>
+
* namespace.cs (UsingEntry.Resolve): Undo change below.
2005-02-21 Raja R Harinath <[EMAIL PROTECTED]>
Modified: trunk/mcs/gmcs/delegate.cs
===================================================================
--- trunk/mcs/gmcs/delegate.cs 2005-04-12 20:52:59 UTC (rev 42874)
+++ trunk/mcs/gmcs/delegate.cs 2005-04-12 20:57:36 UTC (rev 42875)
@@ -538,12 +538,13 @@
Expression ml = Expression.MemberLookup (
ec, delegate_type, "Invoke", loc);
- if (!(ml is MethodGroupExpr)) {
+ MethodGroupExpr me = ml as MethodGroupExpr;
+ if (me == null) {
Report.Error (-100, loc, "Internal error: could
not find Invoke method!" + delegate_type);
return false;
}
- MethodBase mb = ((MethodGroupExpr) ml).Methods [0];
+ MethodBase mb = me.Methods [0];
ParameterData pd = TypeManager.GetParameterData (mb);
int pd_count = pd.Count;
@@ -551,38 +552,24 @@
bool params_method = (pd_count != 0) &&
(pd.ParameterModifier (pd_count - 1) ==
Parameter.Modifier.PARAMS);
- if (!params_method && pd_count != arg_count) {
+ bool is_params_applicable = false;
+ bool is_applicable = Invocation.IsApplicable (ec, me,
args, arg_count, ref mb);
+
+ if (!is_applicable && params_method &&
+ Invocation.IsParamsMethodApplicable (ec, me, args,
arg_count, ref mb))
+ is_applicable = is_params_applicable = true;
+
+ if (!is_applicable && !params_method && arg_count !=
pd_count) {
Report.Error (1593, loc,
"Delegate '{0}' does not take {1}
arguments",
delegate_type.ToString (),
arg_count);
return false;
}
- //
- // Consider the case:
- // delegate void FOO(param object[] args);
- // FOO f = new FOO(...);
- // f(new object[] {1, 2, 3});
- //
- // This should be treated like f(1,2,3). This is done
by ignoring the
- // 'param' modifier for that invocation. If that
fails, then the
- // 'param' modifier is considered.
- //
- // One issue is that 'VerifyArgumentsCompat' modifies
the elements of
- // the 'args' array. However, the modifications appear
idempotent.
- // Normal 'Invocation's also have the same behaviour,
implicitly.
- //
-
- bool ans = false;
- if (arg_count == pd_count)
- ans = Invocation.VerifyArgumentsCompat (
- ec, args, arg_count, mb, false,
+ return Invocation.VerifyArgumentsCompat (
+ ec, args, arg_count, mb,
+ is_params_applicable || (!is_applicable
&& params_method),
delegate_type, false, loc);
- if (!ans && params_method)
- ans = Invocation.VerifyArgumentsCompat (
- ec, args, arg_count, mb, true,
- delegate_type, false, loc);
- return ans;
}
/// <summary>
Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs 2005-04-12 20:52:59 UTC (rev 42874)
+++ trunk/mcs/gmcs/expression.cs 2005-04-12 20:57:36 UTC (rev 42875)
@@ -4665,9 +4665,9 @@
return union;
}
- static bool IsParamsMethodApplicable (EmitContext ec,
MethodGroupExpr me,
- ArrayList arguments, int
arg_count,
- ref MethodBase candidate)
+ public static bool IsParamsMethodApplicable (EmitContext ec,
MethodGroupExpr me,
+ ArrayList
arguments, int arg_count,
+ ref MethodBase
candidate)
{
return IsParamsMethodApplicable (
ec, me, arguments, arg_count, false, ref
candidate) ||
@@ -4777,9 +4777,9 @@
return true;
}
- static bool IsApplicable (EmitContext ec, MethodGroupExpr me,
- ArrayList arguments, int arg_count,
- ref MethodBase candidate)
+ public static bool IsApplicable (EmitContext ec,
MethodGroupExpr me,
+ ArrayList arguments, int
arg_count,
+ ref MethodBase candidate)
{
if (!me.HasTypeArguments &&
!TypeManager.InferTypeArguments (ec, arguments, ref
candidate))
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches