Author: martin
Date: 2005-04-15 12:08:36 -0400 (Fri, 15 Apr 2005)
New Revision: 43062

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/class.cs
   trunk/mcs/gmcs/cs-parser.jay
   trunk/mcs/gmcs/delegate.cs
   trunk/mcs/gmcs/expression.cs
   trunk/mcs/gmcs/statement.cs
Log:
**** Merged r41829 from MCS ****


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2005-04-15 16:07:51 UTC (rev 43061)
+++ trunk/mcs/gmcs/ChangeLog    2005-04-15 16:08:36 UTC (rev 43062)
@@ -1,3 +1,19 @@
+2005-03-15  Marek Safar  <[EMAIL PROTECTED]>
+
+       * class.cs (TypeContainer.CircularDepException) New nested
+       (MethodCore.CheckBase): Report CS1715 for properties and indexers.
+
+       * cs-parser.jay: Reports CS1527 for any namespace element.
+
+       * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
+       Added CS0407.
+       
+       * expression.cs (ParameterReference.IsAssigned): Changed error to
+       CS0269.
+       (Error_WrongNumArguments): Moved CS0245 detection here. 
+       
+       * statement.cs (Return.Resolve): Add CS1622 report.
+
 2005-03-11  Marek Safar  <[EMAIL PROTECTED]>
 
        * class.cs (StaticClass.DefineContainerMembers): Added CS0720.

Modified: trunk/mcs/gmcs/class.cs
===================================================================
--- trunk/mcs/gmcs/class.cs     2005-04-15 16:07:51 UTC (rev 43061)
+++ trunk/mcs/gmcs/class.cs     2005-04-15 16:08:36 UTC (rev 43062)
@@ -1391,6 +1391,8 @@
                        }
 
                        if (current_type != null) {
+                               Report.Debug (64, "DEFINE TYPE", this, Name, 
Location, current_type,
+                                             current_type.GetType ());
                                current_type = 
current_type.ResolveAsTypeTerminal (ec);
                                if (current_type == null) {
                                        error = true;
@@ -3264,8 +3266,14 @@
                                if ((ModFlags & Modifiers.NEW) == 0) {
                                        if (MemberType != 
TypeManager.TypeToCoreType (base_ret_type)) {
                                                
Report.SymbolRelatedToPreviousError (base_method);
-                                               Report.Error (508, Location, 
GetSignatureForError (Parent) + ": cannot " +
-                                                       "change return type 
when overriding inherited member");
+                                               if (this is PropertyBase) {
+                                                       Report.Error (1715, 
Location, "'{0}': type must be '{1}' to match overridden member '{2}'", 
+                                                               
GetSignatureForError (), TypeManager.CSharpName (base_ret_type), 
TypeManager.CSharpSignature (base_method));
+                                               }
+                                               else {
+                                                       Report.Error (508, 
Location, GetSignatureForError (Parent) + ": cannot " +
+                                                               "change return 
type when overriding inherited member");
+                                               }
                                                return false;
                                        }
                                } else {

Modified: trunk/mcs/gmcs/cs-parser.jay
===================================================================
--- trunk/mcs/gmcs/cs-parser.jay        2005-04-15 16:07:51 UTC (rev 43061)
+++ trunk/mcs/gmcs/cs-parser.jay        2005-04-15 16:08:36 UTC (rev 43062)
@@ -434,25 +434,13 @@
 namespace_member_declaration
        : type_declaration
          {
-               string name = "";
-               int mod_flags;
+               if ($1 != null) {
+                       DeclSpace ds = (DeclSpace)$1;
 
-               if ($1 is Class){
-                       Class c = (Class) $1;
-                       mod_flags = c.ModFlags;
-                       name = c.Name;
-               } else if ($1 is Struct){
-                       Struct s = (Struct) $1;
-                       mod_flags = s.ModFlags;
-                       name = s.Name;
-               } else
-                       break;
-
-               if ((mod_flags & (Modifiers.PRIVATE|Modifiers.PROTECTED)) != 0){
-                       Report.Error (
-                               1527, lexer.Location, 
-                               "Namespace elements cant be explicitly " +
-                               "declared private or protected in `" + name + 
"'");
+                       if ((ds.ModFlags & 
(Modifiers.PRIVATE|Modifiers.PROTECTED)) != 0){
+                               Report.Error (1527, lexer.Location, 
+                               "Namespace elements cannot be explicitly 
declared as private, protected or protected internal");
+                       }
                }
                current_namespace.DeclarationFound = true;
          }
@@ -2421,6 +2409,7 @@
                string name = full_name.GetName ();
                current_container.AddEnum (e);
                RootContext.Tree.RecordDecl (name, e);
+               $$ = e;
 
          }
        ;
@@ -2532,6 +2521,7 @@
          SEMICOLON
          {
                current_delegate.SetParameterInfo ((ArrayList) $9);
+               $$ = current_delegate;
 
                current_delegate = null;
          }

Modified: trunk/mcs/gmcs/delegate.cs
===================================================================
--- trunk/mcs/gmcs/delegate.cs  2005-04-15 16:07:51 UTC (rev 43061)
+++ trunk/mcs/gmcs/delegate.cs  2005-04-15 16:08:36 UTC (rev 43062)
@@ -739,30 +739,33 @@
                public static void Error_NoMatchingMethodForDelegate 
(EmitContext ec, MethodGroupExpr mg, Type type, Location loc)
                {
                        string method_desc;
+                       MethodBase found_method = mg.Methods [0];
 
-                       MethodBase candidate = mg.Methods [0];
                        if (mg.Methods.Length > 1)
-                               method_desc = candidate.Name;
+                               method_desc = found_method.Name;
                        else
-                               method_desc = Invocation.FullMethodDesc 
(candidate);
+                               method_desc = Invocation.FullMethodDesc 
(found_method);
 
                        Expression invoke_method = Expression.MemberLookup (
                                ec, type, "Invoke", MemberTypes.Method,
                                Expression.AllBindingFlags, loc);
-                       MethodBase method = ((MethodGroupExpr) 
invoke_method).Methods [0];
+                       MethodInfo method = ((MethodGroupExpr) 
invoke_method).Methods [0] as MethodInfo;
+
                        ParameterData param = TypeManager.GetParameterData 
(method);
                        string delegate_desc = Delegate.FullDelegateDesc (type, 
method, param);
 
                        if (!mg.HasTypeArguments &&
-                           !TypeManager.InferTypeArguments (ec, param, ref 
candidate))
+                           !TypeManager.InferTypeArguments (ec, param, ref 
found_method))
                                Report.Error (411, loc, "The type arguments for 
" +
                                              "method `{0}' cannot be infered 
from " +
                                              "the usage. Try specifying the 
type " +
                                              "arguments explicitly.", 
method_desc);
-                       else
-                               Report.Error (123, loc, "Method '{0}' does not 
" +
-                                             "match delegate '{1}'", 
method_desc,
-                                             delegate_desc);
+                       else if (method.ReturnType != ((MethodInfo) 
found_method).ReturnType) {
+                               Report.Error (407, loc, "'{0}' has the wrong 
return type to match delegate '{1}'", method_desc, delegate_desc);
+                       } else {
+                               Report.Error (123, loc, "Method '" + 
method_desc + "' does not " +
+                                       "match delegate '" + delegate_desc + 
"'");
+                       }
                }
                
                public override void Emit (EmitContext ec)

Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs        2005-04-15 16:07:51 UTC (rev 43061)
+++ trunk/mcs/gmcs/expression.cs        2005-04-15 16:08:36 UTC (rev 43062)
@@ -3903,8 +3903,8 @@
                        if (!ec.DoFlowAnalysis || !is_out || 
ec.CurrentBranching.IsAssigned (vi))
                                return true;
 
-                       Report.Error (165, loc,
-                                     "Use of unassigned parameter `" + name + 
"'");
+                       Report.Error (269, loc,
+                                     "Use of unassigned out parameter '{0}'", 
name);
                        return false;
                }
 
@@ -5140,12 +5140,17 @@
                        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_WrongNumArguments (Location loc, String name, 
int arg_count)
+               {
+                       if (name == "Finalize" && arg_count == 0) {
+                               Report.Error (245, loc, "Destructors and 
object.Finalize cannot be called directly. Consider calling IDisposable.Dispose 
if available");
+                       }
+                       else {
+                               Report.Error (1501, loc,
+                                       "No overload for method `" + name + "' 
takes `" +
+                                       arg_count + "' arguments");
+                       }
+               }
 
                 static void Error_InvokeOnDelegate (Location loc)
                 {
@@ -5347,10 +5352,7 @@
                        }
 
                        if (method.Name == "Finalize" && Arguments == null) {
-                               if (mg.IsBase)
-                                       Report.Error (250, loc, "Do not 
directly call your base class Finalize method. It is called automatically from 
your destructor");
-                               else
-                                       Report.Error (245, loc, "Destructors 
and object.Finalize cannot be called directly. Consider calling 
IDisposable.Dispose if available");
+                               Report.Error (250, loc, "Do not directly call 
your base class Finalize method. It is called automatically from your 
destructor");
                                return null;
                        }
 
@@ -7049,7 +7051,7 @@
                                variable_info.SetAssigned (ec);
                        
                        if (ec.TypeContainer is Class){
-                               Error (1604, "Cannot assign to `this'");
+                               Error (1604, "Cannot assign to 'this' because 
it is read-only");
                                return null;
                        }
 

Modified: trunk/mcs/gmcs/statement.cs
===================================================================
--- trunk/mcs/gmcs/statement.cs 2005-04-15 16:07:51 UTC (rev 43061)
+++ trunk/mcs/gmcs/statement.cs 2005-04-15 16:08:36 UTC (rev 43062)
@@ -580,6 +580,12 @@
                                        return false;
                                }
 
+                               if (ec.InIterator) {
+                                       Report.Error (1622, loc, "Cannot return 
a value from iterators. Use the yield return " +
+                                               "statement to return a value, 
or yield break to end the iteration");
+                                       return false;
+                               }
+
                                Expr = Expr.Resolve (ec);
                                if (Expr == null)
                                        return false;

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

Reply via email to