2004-12-08 Marek Safar <marek.safar@seznam.cz>
authorMarek Safar <marek.safar@gmail.com>
Wed, 8 Dec 2004 11:05:54 +0000 (11:05 -0000)
committerMarek Safar <marek.safar@gmail.com>
Wed, 8 Dec 2004 11:05:54 +0000 (11:05 -0000)
* attribute.cs (Resolve): Add error 591 detection.

* class.cs (FieldMember.Define): Add error 1547 detection.
(Indexer.Define): Add error 620 detection.
(Operator.Define): Add error 590 detection.

* ecore.cs: Missing argument for error 79.

* expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
detection.

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

mcs/mcs/ChangeLog
mcs/mcs/attribute.cs
mcs/mcs/class.cs
mcs/mcs/ecore.cs
mcs/mcs/expression.cs
mcs/mcs/parameter.cs

index 211b5386588471ab89fff211afd2168333bf7453..3e843d0c2dc57d6f19fb341c879123ca627a1e1a 100644 (file)
@@ -1,3 +1,16 @@
+2004-12-08  Marek Safar  <marek.safar@seznam.cz>
+
+       * attribute.cs (Resolve): Add error 591 detection.
+
+       * class.cs (FieldMember.Define): Add error 1547 detection.
+       (Indexer.Define): Add error 620 detection.
+       (Operator.Define): Add error 590 detection.
+
+       * ecore.cs: Missing argument for error 79.
+
+       * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
+       detection.
+
 2004-12-07  Marek Safar  <marek.safar@seznam.cz>
 
        Fix #70106
index 3d0d1a07650ef2cc2de0b2ccf9677ad9c885cab4..f107858922d0d35ab25d648f7343a9afb7532384 100644 (file)
@@ -345,6 +345,10 @@ namespace Mono.CSharp {
 
                                if (DoCompares){
                                        if (usage_attr) {
+                                               if ((int)val == 0) {
+                                                       Report.Error (591, Location, "Invalid value for argument to 'System.AttributeUsage' attribute");
+                                                       return null;
+                                               }
                                                usage_attribute = new AttributeUsageAttribute ((AttributeTargets)val);
                                        } else if (MethodImplAttr) {
                                                this.ImplOptions = (MethodImplOptions) val;
index f6faa4bdffe23b9387764cb3c64fdcd3709edb46..69e0948395d37e4fddcf9d9b3ca78b9a15986c8d 100644 (file)
@@ -5154,19 +5154,6 @@ namespace Mono.CSharp {
                        return true;
                }
 
-               protected override bool DoDefine ()
-               {
-                       if (!base.DoDefine ())
-                               return false;
-
-                       if (MemberType == TypeManager.void_type) {
-                               Report.Error (1547, Location,
-                                             "Keyword 'void' cannot be used in this context");
-                               return false;
-                       }
-                       return true;
-               }
-
                public override string GetSignatureForError ()
                {
                        if (FieldBuilder == null) {
@@ -5246,6 +5233,12 @@ namespace Mono.CSharp {
                                return false;
 
                        MemberType = texpr.ResolveType (ec);
+
+                       if (MemberType == TypeManager.void_type) {
+                               Report.Error (1547, Location, "Keyword 'void' cannot be used in this context");
+                               return false;
+                       }
+
                        ec.InUnsafe = old_unsafe;
 
                        if (!CheckBase ())
@@ -6833,6 +6826,11 @@ namespace Mono.CSharp {
                        if (!base.Define ())
                                return false;
 
+                       if (MemberType == TypeManager.void_type) {
+                               Report.Error (620, Location, "Indexers cannot have void type");
+                               return false;
+                       }
+
                        if (OptAttributes != null) {
                                Attribute indexer_attr = OptAttributes.Search (TypeManager.indexer_name_type, ec);
                                if (indexer_attr != null) {
@@ -7066,6 +7064,11 @@ namespace Mono.CSharp {
                        if (!DoDefine ())
                                return false;
 
+                       if (MemberType == TypeManager.void_type) {
+                               Report.Error (590, Location, "User-defined operators cannot return void");
+                               return false;
+                       }
+
                        OperatorMethod = new Method (
                                Parent, Type, ModFlags, false, MemberName,
                                Parameters, OptAttributes, Location);
index 6ab7a9b7dbbb4829ffd8a7df4653ef887b022566..b0e789a3df166d4e6e4e18bd7b18d8021d56a541 100644 (file)
@@ -3557,7 +3557,7 @@ namespace Mono.CSharp {
                public override void Emit (EmitContext ec)
                {
                        if (instance_expr is This)
-                               Report.Error (79, loc, "The event `{0}' can only appear on the left hand side of += or -=, try calling the actual delegate");
+                               Report.Error (79, loc, "The event `{0}' can only appear on the left hand side of += or -=, try calling the actual delegate", Name);
                        else
                                Report.Error (70, loc, "The event `{0}' can only appear on the left hand side of += or -= "+
                                              "(except on the defining type)", Name);
index d355686f5b6956584d17b4ceb72d7a17bfb51ac8..8f4d3d99cc1687b185ecf62d5a911f624cebd00c 100644 (file)
@@ -8585,6 +8585,12 @@ namespace Mono.CSharp {
                                UnsafeError (loc);
                                return null;
                        }
+
+                       if (type.IsArray && (type.GetElementType () == TypeManager.arg_iterator_type ||
+                               type.GetElementType () == TypeManager.typed_reference_type)) {
+                               Report.Error (611, loc, "Array elements cannot be of type '{0}'", TypeManager.CSharpName (type.GetElementType ()));
+                               return null;
+                       }
                        
                        eclass = ExprClass.Type;
                        return this;
index 209cd0a2d44bf456497f48a35a8816021425d32e..e05a90e6d723119bf91ca1a86d80a7dfdea10900 100644 (file)
@@ -177,7 +177,7 @@ namespace Mono.CSharp {
                        }
 
                        if (parameter_type == TypeManager.void_type){
-                               Report.Error (1536, l, "`void' parameter is not permitted");
+                               Report.Error (1536, l, "Invalid parameter type 'void'");
                                return false;
                        }