[Mono-bugs] [Bug 56986][Wis] New - CS0111: property get_XXX and method set_XXX() are incorrectly allowed (and vice versa)
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 14 Apr 2004 08:10:51 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by atsushi@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=56986
--- shadow/56986 2004-04-14 08:10:51.000000000 -0400
+++ shadow/56986.tmp.10270 2004-04-14 08:10:51.000000000 -0400
@@ -0,0 +1,72 @@
+Bug#: 56986
+Product: Mono: Compilers
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: atsushi@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: CS0111: property get_XXX and method set_XXX() are incorrectly allowed (and vice versa)
+
+CSC does not allow such combination of
+i) property XXX { get; } and method set_XXX()
+ii) property XXX { set; } and method get_XXX()
+
+while mcs treats them as a valid combination.
+
+// get.cs
+using System;
+
+public class Test
+{
+ public static void Main () {}
+ public string get_Value () { return null; }
+ public string Value {
+ set { }
+ }
+}
+
+// set.cs
+using System;
+
+public class Test
+{
+ public static void Main () {}
+ public void set_Value (int i) { }
+ public int Value {
+ get { return 0; }
+ }
+}
+
+Actual Results:
+Both compile successfully.
+
+Expected Results:
+
+get.cs(7,16): error CS0111: Class 'Test' already defines a member called
+ 'get_Value' with the same parameter types
+get.cs(6,16): (Location of symbol related to previous error)
+
+
+set.cs(7,13): error CS0111: Class 'Test' already defines a member called
+ 'set_Value' with the same parameter types
+set.cs(6,14): (Location of symbol related to previous error)
+
+
+How often does this happen?
+- always.
+
+Additional Information:
+
+When property and method are both getter and setter, mcs rejects
+them fine.
+
+IIRC it is not rejected under MS.NET 1.0.