[Mono-bugs] [Bug 78847][Nor] New - [GMCS] gmcs doesn't allow B[] -> IList<A> conversion where B : A.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jul 13 12:35:07 EDT 2006


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 vargaz at gmail.com.

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

--- shadow/78847	2006-07-13 12:35:07.000000000 -0400
+++ shadow/78847.tmp.19794	2006-07-13 12:35:07.000000000 -0400
@@ -0,0 +1,49 @@
+Bug#: 78847
+Product: Mono: Compilers
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: vargaz at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] gmcs doesn't allow B[] -> IList<A> conversion where B : A.
+
+Testcase:
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+using System;
+using System.Collections.Generic;
+
+public class A {
+}
+
+public class B : A {
+}
+
+public class Tests
+{
+	public static void Main ()
+	{
+		IList<A> a = new B [0];
+
+		Console.WriteLine (typeof (IList<A>).IsAssignableFrom (typeof (B[])));
+	}
+}
+
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+csc compiles this done, but gmcs fails with:
+
+bug.cs(14,12): error CS0029: Cannot implicitly convert type `B[]' to
+`System.Collections.Generic.IList<A>'
+
+Also, this might be a runtime problem as well, since the Console.WriteLine
+prints 'True' under MS, and 'False' under mono.


More information about the mono-bugs mailing list