[Mono-bugs] [Bug 59760][Min] New - Waring not issued anymore when only one of Equals() or GetHashCode() is overriden.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 8 Jun 2004 02:00:15 -0400 (EDT)


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 jimeno@servidor.unam.mx.

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

--- shadow/59760	2004-06-08 02:00:15.000000000 -0400
+++ shadow/59760.tmp.31357	2004-06-08 02:00:15.000000000 -0400
@@ -0,0 +1,67 @@
+Bug#: 59760
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jimeno@servidor.unam.mx               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Waring not issued anymore when only one of Equals() or GetHashCode() is overriden.
+
+Description of Problem:
+
+A warning is *not* issued when a class overrides Equals() and do not
+overrides GetHashCode().
+
+
+Steps to reproduce the problem:
+
+1. Write a class which overrides Object.Equals(Object) and do not override
+Object.GetHashCode()
+
+1.5. The following super-simple example can be used:
+class App {
+   public override System.Boolean Equals(System.Object obj) {
+    return true;
+} }
+
+2. Compile the class.
+
+2.5. If the example above is named "app.cs" you can use the following
+command line:
+mcs app.cs -target:library
+
+
+Actual Results:
+
+Compilation succeeded
+
+
+Expected Results:
+
+Warning CS0659
+Compilation succeeded
+
+
+How often does this happen? 
+
+Always (every time).
+
+
+Additional Information:
+
+I remeber Mono 0.30 (or very close to that version) used to issue the
+warning, although I don't remember the precise error message (nor code).
+To obtain the "CS0659" I had a look at paragraph "Object Hash Codes" from
+Jeffrey Richters' "Applied .NET Framework Programming". The chapter I'm
+talking about (chapter 6) can be checked out at:
+
+http://www.developer.com/open/article.php/989091