[Mono-bugs] [Bug 55382][Nor] New - MSC reports invalid warning CS0109 when hiding inherited member of other type

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 9 Mar 2004 15:46:29 -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 gert.driesen@pandora.be.

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

--- shadow/55382	2004-03-09 15:46:29.000000000 -0500
+++ shadow/55382.tmp.7010	2004-03-09 15:46:29.000000000 -0500
@@ -0,0 +1,52 @@
+Bug#: 55382
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gert.driesen@pandora.be               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: MSC reports invalid warning CS0109 when hiding inherited member of other type
+
+When hiding members of a base class that are of another type, mcs reports 
+warning CS0109, saying that the new keyword is not required.
+
+However, this does not match the behaviour of csc.
+
+According to the .NET Framework SDK, name hiding through inheritance takes 
+one of the following forms :
+
+  a.. A constant, field, property, or type introduced in a class or struct
+hides all base class members with the same name.
+  b.. A method introduced in a class or struct hides properties, fields, 
+and types, with the same name, in the base class. It also hides all base 
+class methods with the same signature. For more information, see 3.6 
+Signatures and overloading.
+  c.. An indexer introduced in a class or struct hides all base class
+indexers with the same signature.
+
+So you also have to use the new keyword if the member type of the construct
+that you introduce does not match the member type of the member with the
+same name in the base class.
+
+I attached a repro for this issue, which result in the following output :
+
+mono@fw.home.lan ~]$ mcs -t:library test.cs
+test.cs(20) warning CS0109: The member
+`NDoc.Test.NewStuff.NewDerived.NewPropertySNOKOM' does not hide an 
+inherited
+member.  The keyword new is not required
+test.cs(26) warning CS0109: The member
+`NDoc.Test.NewStuff.NewDerived.NewVirtualPropertySNOKOM' does not hide an
+inherited member.  The keyword new is not required
+Compilation succeeded - 2 warning(s)
+
+The attached source file compiles without warning using csc.