[Mono-bugs] [Bug 52586][Wis] New - We do not handle overriden overloads correctly

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 4 Jan 2004 12:03:50 -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=52586

--- shadow/52586	2004-01-04 12:03:50.000000000 -0500
+++ shadow/52586.tmp.29311	2004-01-04 12:03:50.000000000 -0500
@@ -0,0 +1,67 @@
+Bug#: 52586
+Product: Mono/Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: We do not handle overriden overloads correctly
+
+In this example:
+
+using System;
+
+class A {
+	public virtual void Foo (int i)	{
+		Console.WriteLine ("A.Foo (int i)");
+	}
+	
+	public virtual void Foo (double d) {
+		Console.WriteLine ("A.Foo (double d)");
+	}
+}
+
+class B : A {
+	public override void Foo (double d) {
+		Console.WriteLine ("B.Foo (double d)");
+	}
+	
+	public static void Main () {
+		new B ().Foo (1);
+	}
+}
+
+We print
+
+B.Foo (double d)
+
+While MS prints
+
+A.Foo (int i)
+
+The problem is that according to the spec, 14.3 Member lookup:
+A member lookup of a name N in a type T is processed as follows:
+
+First, the set of all accessible (10.5) members named N declared in T and
+the base types (14.3.1) of T is constructed. >>> Declarations that include
+an override modifier are excluded from the set. <<< If no members named N
+exist and are accessible, then the lookup produces no match, and the
+following steps are not evaluated. 
+
+We do not abide by the clause `Declarations that include an override
+modifier are excluded from the set.' Our member lookup is returning B.Foo.
+
+As such, when we do overload resolve, we follow the clause:
+`6  If N is applicable with respect to A (14.4.2.1), then all methods
+declared in a base type of T are removed from the set.'
+
+Thus, the int overload is incorrectly removed from the applicable members list.