[Mono-bugs] [Bug 30606][Nor] New - mcs report errors when formal parameter is an interface and actual parameter is object that implements the interface

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
19 Sep 2002 07:00:52 -0000


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 mathpup@mylinuxisp.com.

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

--- shadow/30606	Thu Sep 19 03:00:52 2002
+++ shadow/30606.tmp.1958	Thu Sep 19 03:00:52 2002
@@ -0,0 +1,62 @@
+Bug#: 30606
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: SuSE Linux 8.0
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs report errors when formal parameter is an interface and actual parameter is object that implements the interface
+
+Description of Problem:       
+       
+When passing a C# int (i.e. Int32) to a method that expects a parameter of      
+type IComparable, mcs reports an error, even though Int32 implements the      
+IComparable interface.      
+      
+       
+Steps to reproduce the problem:       
+1. Attempt to compile the program below.     
+    
+using System;  
+  
+public class Testing  
+{  
+	public static void Method( IComparable n ) {}  
+	  
+	public static void Main()  
+	{  
+		Method(4);  
+	}  
+}     
+       
+  
+Actual Results:   
+      
+comparable-test.cs(9) error CS1502: The best overloaded match for method   
+'void Method (System.IComparable)' has some invalid arguments   
+comparable-test.cs(9) error CS1503: Argument 1: Cannot convert from 'int'   
+to 'System.IComparable'   
+comparable-test.cs(9) error CS-0006: Could not find any applicable   
+function for this argument list   
+       
+       
+Expected Results:       
+   
+Successful compilation       
+       
+  
+How often does this happen?        
+  
+Every time       
+      
+  
+Additional Information: