Author: marek
Date: 2005-03-15 03:19:50 -0500 (Tue, 15 Mar 2005)
New Revision: 41829
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/class.cs
trunk/mcs/mcs/cs-parser.jay
trunk/mcs/mcs/delegate.cs
trunk/mcs/mcs/expression.cs
trunk/mcs/mcs/statement.cs
Log:
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.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2005-03-15 08:02:10 UTC (rev 41828)
+++ trunk/mcs/mcs/ChangeLog 2005-03-15 08:19:50 UTC (rev 41829)
@@ -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/mcs/class.cs
===================================================================
--- trunk/mcs/mcs/class.cs 2005-03-15 08:02:10 UTC (rev 41828)
+++ trunk/mcs/mcs/class.cs 2005-03-15 08:19:50 UTC (rev 41829)
@@ -3008,8 +3008,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/mcs/cs-parser.jay
===================================================================
--- trunk/mcs/mcs/cs-parser.jay 2005-03-15 08:02:10 UTC (rev 41828)
+++ trunk/mcs/mcs/cs-parser.jay 2005-03-15 08:19:50 UTC (rev 41829)
@@ -418,25 +418,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;
}
@@ -2316,6 +2304,7 @@
string name = full_name.GetName ();
current_container.AddEnum (e);
RootContext.Tree.RecordDecl (name, e);
+ $$ = e;
}
;
@@ -2416,6 +2405,7 @@
current_container.AddDelegate (del);
RootContext.Tree.RecordDecl (name.GetName (true), del);
+ $$ = del;
}
;
Modified: trunk/mcs/mcs/delegate.cs
===================================================================
--- trunk/mcs/mcs/delegate.cs 2005-03-15 08:02:10 UTC (rev 41828)
+++ trunk/mcs/mcs/delegate.cs 2005-03-15 08:19:50 UTC (rev 41829)
@@ -692,21 +692,27 @@
public static void Error_NoMatchingMethodForDelegate
(EmitContext ec, MethodGroupExpr mg, Type type, Location loc)
{
string method_desc;
+ MethodInfo found_method = (MethodInfo)mg.Methods [0];
if (mg.Methods.Length > 1)
- method_desc = mg.Methods [0].Name;
+ method_desc = found_method.Name;
else
- method_desc = Invocation.FullMethodDesc
(mg.Methods [0]);
+ 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);
-
- Report.Error (123, loc, "Method '" + method_desc + "'
does not " +
- "match delegate '" + delegate_desc + "'");
+
+ if (method.ReturnType != 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/mcs/expression.cs
===================================================================
--- trunk/mcs/mcs/expression.cs 2005-03-15 08:02:10 UTC (rev 41828)
+++ trunk/mcs/mcs/expression.cs 2005-03-15 08:19:50 UTC (rev 41829)
@@ -3855,8 +3855,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;
}
@@ -5044,12 +5044,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)
{
@@ -5247,10 +5252,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;
}
@@ -6891,7 +6893,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/mcs/statement.cs
===================================================================
--- trunk/mcs/mcs/statement.cs 2005-03-15 08:02:10 UTC (rev 41828)
+++ trunk/mcs/mcs/statement.cs 2005-03-15 08:19:50 UTC (rev 41829)
@@ -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