Hi,

Attached is yet another patch, which removes the BC0542 error 
(member has same name as enclosing type). vbc allows members to have
the same name as their enclosing type (csc and mcs do not!).

This patch makes a couple more tests succeed.

I've sent this email to both the Brazilian mbas mailing list and the
mono-vb one, please let me know if either one is preferred.

Cheers,

Jelmer
Index: genericparser.cs
===================================================================
--- genericparser.cs    (revision 53230)
+++ genericparser.cs    (working copy)
@@ -296,10 +296,6 @@
                                                name + "' with the same 
parameter types (more than one default constructor)");
                                        break;
 
-                               case AdditionResult.EnclosingClash:
-                                       Report.Error (542, l, "Member names 
cannot be the same as their enclosing type");
-                                       break;
-               
                                case AdditionResult.NotAConstructor:
                                        Report.Error (1520, l, "Class, struct, 
or interface method must have a return type");
                                        break;
Index: class.cs
===================================================================
--- class.cs    (revision 53230)
+++ class.cs    (working copy)
@@ -256,9 +256,6 @@
                        if (value != null && (!(value is Method)))
                                return AdditionResult.NameExists;
 
-                       if (basename == Basename)
-                               return AdditionResult.EnclosingClash;
-                       
                        if (methods == null)
                                methods = new ArrayList ();
 
Index: decl.cs
===================================================================
--- decl.cs     (revision 53230)
+++ decl.cs     (working copy)
@@ -199,15 +199,6 @@
                        NameExists,
 
                        /// <summary>
-                       ///   Returned if the declation being added to the
-                       ///   name space clashes with its container name.
-                       ///
-                       ///   The only exceptions for this are constructors
-                       ///   and static constructors
-                       /// </summary>
-                       EnclosingClash,
-
-                       /// <summary>
                        ///   Returned if a constructor was created (because 
syntactically
                        ///   it looked like a constructor) but was not 
(because the name
                        ///   of the method is not the same as the container 
class
@@ -273,9 +264,6 @@
                /// </summary>
                protected AdditionResult IsValid (string name)
                {
-                       if (name == Basename)
-                               return AdditionResult.EnclosingClash;
-
                        if (defined_names.Contains (name))
                                return AdditionResult.NameExists;
 
Index: ChangeLog
===================================================================
--- ChangeLog   (revision 53230)
+++ ChangeLog   (working copy)
@@ -1,3 +1,7 @@
+2005-11-18 Jelmer Vernooij <[EMAIL PROTECTED]>
+       * genericparser.cs,decl.cs,class.cs: allow members with the same name 
+       as their enclosing type, just like vbc does
+
 2005-11-09 Renato Suga <[EMAIL PROTECTED]>
        * mb-parser.jay: added STOP to statement rule to allow a keyword STOP
        in an iteration_statement.

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Mono-vb mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/mono-vb

Reply via email to