[Mono-bugs] [Bug 52458][Nor] Changed - Scope problem when overriding private method in nested type

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 29 Feb 2004 16:06:32 -0500 (EST)


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 bmaurer@users.sf.net.

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

--- shadow/52458	2004-02-28 14:22:52.000000000 -0500
+++ shadow/52458.tmp.3324	2004-02-29 16:06:32.000000000 -0500
@@ -140,6 +140,48 @@
 2) Clean up MemberSignature comparing stuff, so it doesnt do boxing
 (now called more because of ^)
 
 3) Avoid type lookups when checking for dup methods
 
 
+
+------- Additional Comments From bmaurer@users.sf.net  2004-02-29 16:06 -------
+Ok, here is a full change log (not the first part, because miguel
+applied that):
+
+class.cs, decl.cs: Add a method FindMethodToOverride for looking up
+the base for overriding methods. The reason we have this is two fold.
+First,  we are able to use the MemberCache here, which gains us alot
+of speed as compared to the lookup system.
+
+The second reason is that the spec has some different visibility
+requirements for overrideing. For example, the following is not valid:
+
+class A {
+	public virtual int Blah () { return 1; }
+}
+
+class B : A {
+	new int Blah () { return 0; }
+	
+	class C : B {
+		
+		public override int Blah () { return 2; }
+		static void Main () {
+			Console.WriteLine (new C ().Blah ());
+		}
+	}
+}
+
+CSC gives
+t.cs(14,23): error CS0506: 'B.C.Blah()' : cannot override inherited member
+'B.Blah()' because it is not marked virtual, abstract, or override
+t.cs(10,10): (Location of symbol related to previous error)
+t.cs(14,23): error CS0507: 'B.C.Blah()': cannot change access modifiers
+when overriding 'private' inherited member 'B.Blah()'t.cs(10,10):
+(Location
+of symbol related to previous error)
+
+CSC does not follow the spec to the letter here. Before, we were
+following the spec, however, this makes us follow CSC's behavior.
+
+See bug 52458 for details.