[Mono-bugs] [Bug 39462][Nor] New - Incorrect warning when overriding a delegate with a method.

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 11 Mar 2003 04:02:54 -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 mikea@mailbox.co.za.

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

--- shadow/39462	Tue Mar 11 04:02:54 2003
+++ shadow/39462.tmp.30714	Tue Mar 11 04:02:54 2003
@@ -0,0 +1,83 @@
+Bug#: 39462
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mikea@mailbox.co.za               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Incorrect warning when overriding a delegate with a method.
+
+Description of Problem:
+When overriding a delegate in the parent class with a method
+in the child class, the keyword 'new' should be required.
+
+If I use 'new', mcs warns that it is not required.
+If I remove 'new', mcs warns that it is required.
+( It should be required )
+
+Steps to reproduce the problem:
+1. Compile the following...
+--------
+using System;                                           
+namespace TestSpace                                     
+{                                                       
+  public class CMain                                    
+  {                                                     
+    public static void Main()                           
+    {                                                   
+      CTest2 Tst2 = new CTest2();                       
+      Tst2.setRange(20,20);                             
+    }                                                   
+  }                                                     
+                                                        
+  public class CTest1                                   
+  {                                                     
+    public delegate void setRangeDelegate(int x, int y);
+    public setRangeDelegate setRange;                   
+                                                        
+    CTest1()                                            
+    {                                                   
+      setRange = new setRangeDelegate(defaultsetRange); 
+    }                                                   
+                                                        
+    void defaultsetRange(int x, int y)                  
+    {                                                   
+      Console.WriteLine("CTest1.defaultsetRange"); 
+    }                                              
+  }                                                
+                                                   
+  public class CTest2 : CTest1                     
+  {                                                
+    public new void setRange(int x, int y)         
+    {                                              
+      base.setRange(x, y);                         
+      Console.WriteLine("CTest2.setRange");        
+    }                                              
+  }                                                
+}                                                  
+-------
+
+2. 
+3. 
+
+Actual Results:
+t.cs(31) warning CS0109: The member `TestSpace.CTest2.setRange' does not 
+hide an inherited member.  The keyword new is notrequired
+Compilation succeeded - 1 warning(s)
+
+Expected Results:
+Should compile without warning
+
+How often does this happen? 
+Always
+
+Additional Information: