2003-07-14 Ravi Pratap M <ravi@ximian.com>
authorRavi Pratap M <ravi@mono-cvs.ximian.com>
Mon, 14 Jul 2003 15:35:58 +0000 (15:35 -0000)
committerRavi Pratap M <ravi@mono-cvs.ximian.com>
Mon, 14 Jul 2003 15:35:58 +0000 (15:35 -0000)
* attribute.cs (Attribute.Resolve): While doing a Member lookup
for .ctors, ensure that we only ask for members declared in the
attribute type (BindingFlags.DeclaredOnly).

Fixes bug #43632.

* expression.cs (Error_WrongNumArguments): Report error 1501
correctly the way CSC does.

svn path=/trunk/mcs/; revision=16210

mcs/mcs/ChangeLog
mcs/mcs/attribute.cs
mcs/mcs/expression.cs

index 29cc14049209bc325b3424c82e8c4ec279f7fe70..29199c5c538e1a771266b35b7db9ebf0a998a1f3 100755 (executable)
@@ -1,3 +1,14 @@
+2003-07-14  Ravi Pratap M  <ravi@ximian.com>
+
+       * attribute.cs (Attribute.Resolve): While doing a Member lookup
+       for .ctors, ensure that we only ask for members declared in the
+       attribute type (BindingFlags.DeclaredOnly).
+
+       Fixes bug #43632.
+
+       * expression.cs (Error_WrongNumArguments): Report error 1501
+       correctly the way CSC does.
+
 2003-07-13  Martin Baulig  <martin@ximian.com>
 
        * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
index 10c56402f1f9d5b85e8d3f23391c5f2c57178c38..8400748fe900adf677e8c28d1c677b584bbf3087 100644 (file)
@@ -72,9 +72,8 @@ namespace Mono.CSharp {
 \r
                static void Error_AttributeConstructorMismatch (Location loc)\r
                {\r
-                       Report.Error (\r
-                                       -6, loc,\r
-                                       "Could not find a constructor for this argument list.");\r
+                       Report.Error (-6, loc,\r
+                                      "Could not find a constructor for this argument list.");\r
                }\r
                \r
                private Type CheckAttributeType (EmitContext ec) {\r
@@ -323,7 +322,8 @@ namespace Mono.CSharp {
 \r
                        Expression mg = Expression.MemberLookup (\r
                                ec, Type, ".ctor", MemberTypes.Constructor,\r
-                               BindingFlags.Public | BindingFlags.Instance, Location);\r
+                               BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly,\r
+                                Location);\r
 \r
                        if (mg == null) {\r
                                Error_AttributeConstructorMismatch (Location);\r
index d905b4da26e7a5a58d8b4f2c56c047b2db3cbeb5..d6d79362348b65f672103bf3ff92ef2b4430d217 100755 (executable)
@@ -4275,6 +4275,7 @@ namespace Mono.CSharp {
                        else
                                arg_count = arguments.Count;
 
+
                        ParameterData pd = GetParameterData (candidate);
 
                        int pd_count = pd.Count;
@@ -4410,7 +4411,13 @@ namespace Mono.CSharp {
                                        VerifyArgumentsCompat (ec, Arguments, argument_count, c, false,
                                                               null, loc);
                                }
-                               
+
+                                string report_name = me.Name;
+                                if (report_name == ".ctor")
+                                        report_name = me.DeclaringType.ToString ();
+                                
+                                Error_WrongNumArguments (loc, report_name, argument_count);
+                                                                        
                                return null;
                        }
 
@@ -4455,6 +4462,13 @@ namespace Mono.CSharp {
                        return method;
                }
 
+                static void Error_WrongNumArguments (Location loc, String name, int arg_count)
+                {
+                        Report.Error (1501, loc,
+                                      "No overload for method `" + name + "' takes `" +
+                                      arg_count + "' arguments");
+                }
+
                static void Error_InvalidArguments (Location loc, int idx, MethodBase method,
                                                     Type delegate_type, string arg_sig, string par_desc)
                {