Bug 13289 - CS0314 with partial classes and constraints (REGRESSION) - order of input files matters
Summary: CS0314 with partial classes and constraints (REGRESSION) - order of input fil...
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2013-07-17 07:14 UTC by Ole Hyldahl Tolshave
Modified: 2013-07-18 14:55 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
ZIP-archive containing 3 C#-files. (622 bytes, application/x-zip-compressed)
2013-07-17 07:14 UTC, Ole Hyldahl Tolshave
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Ole Hyldahl Tolshave 2013-07-17 07:14:16 UTC
Created attachment 4356 [details]
ZIP-archive containing 3 C#-files.

I have a quite complictaed class system with a lot of partial classes and generic parameter constraints.

The library fails to compile with mono 3.1.2, but compiles just fine on 2.10.9 (and Visual Studio 2012).

I have isolated the attached test case with consists only 3 files. 

How to reproduce:
Unzip the attached zip file and build with:
$ mcs BD.cs Program.cs GPD.cs /out:Test.exe

What happens (on mono 3.1.2):
MCS fails with this error:
--------------------------------------------------
GPD.cs(5,30): error CS0314: The type `T2' cannot be used as type parameter `T' in the generic type or method `PC<T>'. There is no boxing or type parameter conversion from `T2' to `PD'
Program.cs(10,17): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings

What should have happened (and does happen with 2.10.9);
The program builds and when executed simply prints "Done".

NOTICE!
When changing the build command to (order of input files changed):
mcs Program.cs BD.cs GPD.cs /out:Test.exe 

then 3.1.2 builds fine. I tried changing the order of the input files on 2.10.9, but 2.10.9 appears to be working with any order.
Comment 1 Marek Safar 2013-07-18 05:01:30 UTC
Fixed in master.

Nice test case, thanks for the effort.
Comment 2 Ole Hyldahl Tolshave 2013-07-18 14:55:12 UTC
Thank you for your swift response. I can confirm that the fix does indeed work for the attached test case.

However, I have created a new bug 13324 that is probably related.