Bug 321564 (MONO78847) - [GMCS] gmcs doesn't allow B[] -> IList<A> conversion where B : A.
Summary: [GMCS] gmcs doesn't allow B[] -> IList<A> conversion where B : A.
Status: RESOLVED FIXED
Alias: MONO78847
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.0
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-13 19:35 UTC by Forgotten User vxPDddArjq
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Patch for the GMCS part (3.24 KB, patch)
2006-07-21 14:19 UTC, Thomas Wiest
Details | Diff
Patch for corlib (9.43 KB, patch)
2006-07-21 14:19 UTC, Thomas Wiest
Details | Diff
Patch for the runtime (7.95 KB, patch)
2006-07-21 14:20 UTC, Thomas Wiest
Details | Diff
Updated runtime patch (7.95 KB, patch)
2006-08-31 21:44 UTC, Thomas Wiest
Details | Diff
Updated corlib patch. (9.43 KB, patch)
2006-08-31 21:46 UTC, Thomas Wiest
Details | Diff
Updated runtime patch; this is the right patch file. (10.30 KB, patch)
2006-08-31 21:46 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:03:34 UTC


---- Reported by vargaz@gmail.com 2006-07-13 12:35:07 MST ----

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.



---- Additional Comments From martin@ximian.com 2006-07-21 07:19:16 MST ----

Created an attachment (id=170111)
Patch for the GMCS part




---- Additional Comments From martin@ximian.com 2006-07-21 07:19:36 MST ----

Created an attachment (id=170112)
Patch for corlib




---- Additional Comments From martin@ximian.com 2006-07-21 07:20:01 MST ----

Created an attachment (id=170113)
Patch for the runtime




---- Additional Comments From martin@ximian.com 2006-07-21 10:33:03 MST ----

The gmcs patch is now in SVN.



---- Additional Comments From vargaz@gmail.com 2006-08-15 15:54:44 MST ----

*** https://bugzilla.novell.com/show_bug.cgi?id=MONO78906 has been marked as a duplicate of this bug. ***



---- Additional Comments From martin@ximian.com 2006-08-31 14:18:18 MST ----

*** https://bugzilla.novell.com/show_bug.cgi?id=MONO79145 has been marked as a duplicate of this bug. ***



---- Additional Comments From martin@ximian.com 2006-08-31 14:44:36 MST ----

Created an attachment (id=170114)
Updated runtime patch




---- Additional Comments From martin@ximian.com 2006-08-31 14:46:11 MST ----

Created an attachment (id=170115)
Updated corlib patch.




---- Additional Comments From martin@ximian.com 2006-08-31 14:46:43 MST ----

Created an attachment (id=170116)
Updated runtime patch; this is the right patch file.




---- Additional Comments From martin@ximian.com 2006-09-01 13:49:34 MST ----

Original test case is in gtest-285.cs.



---- Additional Comments From martin@ximian.com 2006-09-01 13:59:08 MST ----

Fixed in SVN.



---- Additional Comments From martin@ximian.com 2006-09-01 13:59:51 MST ----

*** https://bugzilla.novell.com/show_bug.cgi?id=MONO77348 has been marked as a duplicate of this bug. ***

This bug blocked bug(s) 77348.
Imported an attachment (id=170111)
Imported an attachment (id=170112)
Imported an attachment (id=170113)
Imported an attachment (id=170114)
Imported an attachment (id=170115)
Imported an attachment (id=170116)

Unknown operating system unknown. Setting to default OS "Other".