Bug 17647 - Mono C# compiler incorrectly emits CS0695 for concrete instances of generic types
Summary: Mono C# compiler incorrectly emits CS0695 for concrete instances of generic t...
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 3.2.x
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2014-02-06 17:53 UTC by Richard Cook
Modified: 2014-02-25 13:17 UTC (History)
4 users (show)

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

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 Richard Cook 2014-02-06 17:53:32 UTC
Here's a minimal repro case:

===== Test.cs =====
class A<T>
{
    public interface IB { }
}

class C { }
class D { }

class E : A<C>.IB, A<D>.IB
{
}
===== End of Test.cs =====

Here's the output from running against Mono master:

$ mcs --version
Mono C# compiler version 3.2.7.0
$ mcs Test.cs /target:library
Test.cs(11,7): error CS0695: `E' cannot implement both `A<C>.IB' and `A<D>.IB' because they may unify for some type parameter substitutions
Compilation failed: 1 error(s), 0 warnings

Here's the output from running against Mono 2.10.9:

$ mcs --version
Mono C# compiler version 2.10.9.0
$ mcs Test.cs /target:library

This also compiles as expected using csc.exe. It looks like the compiler is incorrectly treating A<C> and A<D> as generic types instead of concrete types.

Thanks, Richard.

Richard Cook | Principal engineer
Coverity | Columbia Center Tower | 701 Fifth Avenue, Suite 1220 | Seattle, WA
98104
The Leader in Development Testing
Read our profile in Forbes, Coverity Gets Code Right 25% Faster
Comment 1 Marek Safar 2014-02-17 05:16:11 UTC
Fixed in master
Comment 2 Richard Cook 2014-02-17 12:25:19 UTC
Thank you. I found the commit: https://github.com/mono/mono/commit/3f08ba83cc73218377a3b10929f87e1335e5bd63