[Mono-bugs] [Bug 39665][Min] New - MCS error with types

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Thu, 13 Mar 2003 12:52:39 -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 crichton@gimp.org.

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

--- shadow/39665	Thu Mar 13 12:52:39 2003
+++ shadow/39665.tmp.5979	Thu Mar 13 12:52:39 2003
@@ -0,0 +1,109 @@
+Bug#: 39665
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: crichton@gimp.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: MCS error with types
+
+In the recent version of XML-RPC.NET, we have some code that csc can
+handle, but mcs can't.
+
+Here's the XmlRpcBoolean class that is causing problems.
+
+---
+namespace CookComputing.XmlRpc
+{
+  public class XmlRpcBoolean
+  {
+    private bool _value;
+ 
+    public XmlRpcBoolean()
+    {
+    }
+ 
+    public XmlRpcBoolean(bool val)
+    {
+      this._value = val;
+    }
+ 
+    public override string ToString()
+    {
+      return _value.ToString();
+    }
+ 
+    public override int GetHashCode()
+    {
+      return _value.GetHashCode();
+    }
+                                                                          
+     
+    public override bool Equals(
+      object o)
+    {
+      if (o == null || !(o is XmlRpcBoolean))
+        return false;
+      XmlRpcBoolean dbl = o as XmlRpcBoolean;
+      return (dbl._value == _value);
+    }
+                                                                          
+     
+    public static bool operator ==(
+      XmlRpcBoolean xi,
+      XmlRpcBoolean xj)
+    {
+      if (((object)xi) == null && ((object)xj) == null)
+        return true;
+      else if (((object)xi) == null || ((object)xj) == null)
+        return false;
+      else
+        return xi._value == xj._value;
+    }
+                                                                          
+         public static bool operator != (
+      XmlRpcBoolean xi,
+      XmlRpcBoolean xj)
+    {
+      return !(xi == xj);
+    }
+                                                                          
+     
+    public static implicit operator bool (XmlRpcBoolean x)
+    {
+      return x._value;
+    }
+                                                                          
+     
+    public static implicit operator XmlRpcBoolean(bool x)
+    {
+      return new XmlRpcBoolean(x);
+    }
+  }
+}
+---
+The code that mcs fails to compile is the following:
+(Code is from a XmlRpcDouble class...)
+---
+public override bool Equals(
+      object o)
+    {
+      if (o == null || !(o is XmlRpcDouble))
+        return false;
+      XmlRpcDouble dbl = o as XmlRpcDouble;
+      return new XmlRpcBoolean(dbl._value == _value);
+    }
+---
+with the following error:
+
+XmlRpcDouble.cs(59) error CS0029: Cannot convert implicitly from
+`CookComputing.XmlRpc.XmlRpcBoolean' to `bool'