Bug 314133 (MONO55786) - `override' members should not be included in member lookup
Summary: `override' members should not be included in member lookup
Status: RESOLVED FIXED
Alias: MONO55786
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: V1
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-19 03:51 UTC by Ben Maurer
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:30:31 UTC


---- Reported by bmaurer@users.sf.net 2004-03-18 20:51:22 MST ----

The following code:
class A {
	public virtual int Foo () { return 1; }
}
class B : A {
	new int Foo () { return 2; }
	static void Main () { System.Console.WriteLine (new C ().Foo ()); }
}
class C : B {
	public override int Foo () { return 1; }
}

prints `2' when compiled with csc, but `1' when compiled with mcs.

§14.3 of the spec states that:

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.

We do not follow the last statement.



---- Additional Comments From bmaurer@users.sf.net 2004-03-18 20:53:36 MST ----

we have to do this for properties too, so it is going to be !fun.



---- Additional Comments From bmaurer@users.sf.net 2004-03-18 21:46:50 MST ----

Actually, this may not be so hard. We could just not put override
methods in the MemberCache.



---- Additional Comments From bmaurer@users.sf.net 2004-03-18 21:51:19 MST ----

Actually, if I fix the bug in the way above, I could simplify the
Property code in such a way that it would fix https://bugzilla.novell.com/show_bug.cgi?id=MONO55780.



---- Additional Comments From bmaurer@users.sf.net 2004-03-19 19:38:14 MST ----

Ok, so my first idea did not work. You get tons of problems with base.
because it will call the first implementation of the virtual call, not
the one in the base class.

Sys.Reflection sucks for writing this sorta thing :-(



---- Additional Comments From martin@ximian.com 2004-04-28 19:55:15 MST ----

This is a normal bug, not wishlist.



---- Additional Comments From rharinath@novell.com 2005-02-15 06:58:34 MST ----

Fixed in SVN.


This bug blocked bug(s) 55780 64540.

Unknown operating system unknown. Setting to default OS "Other".