[Mono-bugs] [Bug 31782][Nor] New - mcs doesn't allow for overriding just a getter or a setter of a property

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
5 Oct 2002 05:45:01 -0000


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 vladimir@pobox.com.

http://bugzilla.ximian.com/show_bug.cgi?id=31782

--- shadow/31782	Sat Oct  5 01:45:01 2002
+++ shadow/31782.tmp.31547	Sat Oct  5 01:45:01 2002
@@ -0,0 +1,56 @@
+Bug#: 31782
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vladimir@pobox.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs doesn't allow for overriding just a getter or a setter of a property
+
+Given:
+
+/* codestart */
+class Base {
+        int thingy = 0;
+        public virtual int Thingy {
+                get { return thingy; }
+                set { thingy = value; }
+        }
+}
+
+class Derived : Base {
+        public int BaseThingy {
+                get { return Thingy; }
+        }
+
+        public override int Thingy {
+                // override the set constructor
+                set { }
+        }
+}
+
+class Driver {
+        static int Main (string[] args) {
+                Derived d = new Derived ();
+                System.Console.WriteLine ("d.BaseThingy: " + d.BaseThingy);
+                return 1;
+        }
+}
+/* codeend */
+
+mcs fails with:
+bar.cs(12) error CS0154: The property `Thingy' can not be used in this
+context because it lacks a get accessor
+
+However, CSc compiles this fine (and the result is as-expected).  I don't
+have the language specs to find out whether this is legal or not, but I ran
+into this usage case in CsGL.