Author: martin
Date: 2005-03-22 05:22:36 -0500 (Tue, 22 Mar 2005)
New Revision: 42085

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/class.cs
   trunk/mcs/gmcs/delegate.cs
   trunk/mcs/gmcs/ecore.cs
   trunk/mcs/gmcs/expression.cs
   trunk/mcs/gmcs/pending.cs
Log:
**** Merged r40984-r41087 from MCS ****


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2005-03-22 10:20:50 UTC (rev 42084)
+++ trunk/mcs/gmcs/ChangeLog    2005-03-22 10:22:36 UTC (rev 42085)
@@ -1,5 +1,47 @@
+2005-02-23  Raja R Harinath  <[EMAIL PROTECTED]>
+           Abin Thomas  <[EMAIL PROTECTED]>
+           Anoob V E  <[EMAIL PROTECTED]>
+           Harilal P R  <[EMAIL PROTECTED]>
+
+       Fix #57851, #72718.
+       * class.cs (ConstructorBuilder.Resolve): Make sure that the second
+       MemberLookup (used for error reporting) actually returns a result.
+       Fix error report number (122, not 112).
+
+2005-02-22  Abin Thomas  <[EMAIL PROTECTED]>
+           Anoob V E  <[EMAIL PROTECTED]>
+           Harilal P R  <[EMAIL PROTECTED]>
+
+       Fix #71134.
+       * pending.cs (PendingImplementation.GetAbstractMethods):
+       Find NonPublic members too.
+
+2005-02-22  Marek Safar  <[EMAIL PROTECTED]>
+
+       * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
+       Fixed error 217.
+       
+       * class.cs (MethodCore.CheckMethodAgainstBase):
+       Add error 239 report.
+
 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/class.cs
===================================================================
--- trunk/mcs/gmcs/class.cs     2005-03-22 10:20:50 UTC (rev 42084)
+++ trunk/mcs/gmcs/class.cs     2005-03-22 10:22:36 UTC (rev 42085)
@@ -3414,17 +3414,9 @@
                                // Now we check that the overriden method is 
not final
                                
                                if (base_method.IsFinal) {
-                                       // This happens when implementing 
interface methods.
-                                       if (base_method.IsHideBySig && 
base_method.IsVirtual) {
-                                               Report.Error (
-                                                       506, Location, 
Parent.MakeName (Name) +
-                                                       ": cannot override 
inherited member `" +
-                                                       name + "' because it is 
not " +
-                                                       "virtual, abstract or 
override");
-                                       } else
-                                               Report.Error (239, Location, 
Parent.MakeName (Name) + " : cannot " +
-                                                             "override 
inherited member `" + name +
-                                                             "' because it is 
sealed.");
+                                       Report.SymbolRelatedToPreviousError 
(base_method);
+                                       Report.Error (239, Location, "'{0}': 
cannot override inherited member '{1}' because it is sealed",
+                                                             
GetSignatureForError (), TypeManager.CSharpSignature (base_method));
                                        ok = false;
                                }
                                //
@@ -4318,6 +4310,7 @@
                {
                        Expression base_constructor_group;
                        Type t;
+                       bool error = false;
 
                        ec.CurrentBlock = new ToplevelBlock 
(Block.Flags.Implicit, parameters, loc);
 
@@ -4348,34 +4341,34 @@
                                loc);
                        
                        if (base_constructor_group == null){
+                               error = true;
                                base_constructor_group = 
Expression.MemberLookup (
-                                       ec, t, ".ctor", MemberTypes.Constructor,
+                                       ec, t, null, t, ".ctor", 
MemberTypes.Constructor,
                                        BindingFlags.NonPublic | 
BindingFlags.Instance | BindingFlags.DeclaredOnly,
                                        loc);
+                       }
 
-                               if (base_constructor_group != null)
-                                       Report.Error (
-                                               112, loc, "`{0}.{1}' is 
inaccessible due to " +
-                                               "its protection level", 
t.FullName, t.Name);
-                               else
-                                       Report.Error (
-                                               1501, loc, "Can not find a 
constructor for " +
-                                               "this argument list");
+                       int errors = Report.Errors;
+                       if (base_constructor_group != null)
+                               base_constructor = (ConstructorInfo) 
Invocation.OverloadResolve (
+                                       ec, (MethodGroupExpr) 
base_constructor_group, argument_list,
+                                       false, loc);
+                       
+                       if (base_constructor == null) {
+                               if (errors == Report.Errors)
+                                       Report.Error (1501, loc, "Can not find 
a constructor for this argument list");
                                return false;
                        }
-                       
-                       base_constructor = (ConstructorInfo) 
Invocation.OverloadResolve (
-                               ec, (MethodGroupExpr) base_constructor_group, 
argument_list,
-                               false, loc);
-                       
-                       if (base_constructor == null){
-                               Report.Error (1501, loc,
-                                      "Can not find a constructor for this 
argument list");
+
+                       if (error) {
+                               Report.Error (122, loc, "`{0}' is inaccessible 
due to its protection level",
+                                             TypeManager.CSharpSignature 
(base_constructor));
+                               base_constructor = null;
                                return false;
                        }
                        
                        if (base_constructor == caller_builder){
-                               Report.Error (516, String.Format ("Constructor 
`{0}' can not call itself", TypeManager.CSharpSignature (caller_builder)));
+                               Report.Error (516, loc, "Constructor `{0}' can 
not call itself", TypeManager.CSharpSignature (caller_builder));
                                return false;
                        }
                        

Modified: trunk/mcs/gmcs/delegate.cs
===================================================================
--- trunk/mcs/gmcs/delegate.cs  2005-03-22 10:20:50 UTC (rev 42084)
+++ trunk/mcs/gmcs/delegate.cs  2005-03-22 10:22:36 UTC (rev 42085)
@@ -537,12 +537,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;
@@ -550,38 +551,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/ecore.cs
===================================================================
--- trunk/mcs/gmcs/ecore.cs     2005-03-22 10:20:50 UTC (rev 42084)
+++ trunk/mcs/gmcs/ecore.cs     2005-03-22 10:22:36 UTC (rev 42085)
@@ -3422,6 +3422,11 @@
                                return null;
                        }
 
+                       if (PropertyInfo.PropertyType.IsPointer && 
!ec.InUnsafe){
+                               UnsafeError (loc);
+                               return null;
+                       }
+
                        return this;
                }
 

Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs        2005-03-22 10:20:50 UTC (rev 42084)
+++ trunk/mcs/gmcs/expression.cs        2005-03-22 10:22:36 UTC (rev 42085)
@@ -3384,11 +3384,17 @@
                        method = Invocation.OverloadResolve (
                                ec, (MethodGroupExpr) operator_group, 
arguments, false, loc)
                                as MethodInfo;
-                       if ((method == null) || (method.ReturnType != type)) {
+                       if (method == null) {
                                Error19 ();
                                return null;
                        }
 
+                       if (method.ReturnType != type) {
+                               Report.Error (217, loc, "In order to be 
applicable as a short circuit operator a user-defined logical operator ('{0}') 
" +
+                                               "must have the same return type 
as the type of its 2 parameters", TypeManager.CSharpSignature (method));
+                               return null;
+                       }
+
                        op = new StaticCallExpr (method, arguments, loc);
 
                        op_true = GetOperatorTrue (ec, left_temp, loc);
@@ -4664,9 +4670,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) ||
@@ -4776,9 +4782,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))

Modified: trunk/mcs/gmcs/pending.cs
===================================================================
--- trunk/mcs/gmcs/pending.cs   2005-03-22 10:20:50 UTC (rev 42084)
+++ trunk/mcs/gmcs/pending.cs   2005-03-22 10:22:36 UTC (rev 42085)
@@ -102,8 +102,8 @@
                                
                                mi = TypeContainer.FindMembers (
                                        current_type, MemberTypes.Method,
-                                       BindingFlags.Public | 
BindingFlags.Instance |
-                                       BindingFlags.DeclaredOnly,
+                                       BindingFlags.Public | 
BindingFlags.NonPublic |
+                                       BindingFlags.Instance | 
BindingFlags.DeclaredOnly,
                                        virtual_method_filter, null);
 
                                if (current_type == TypeManager.object_type)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to