Bug 9545 - Explicitly implement an interface method with weaker type parameter constraint
Summary: Explicitly implement an interface method with weaker type parameter constraint
Alias: None
Product: Runtime
Classification: Mono
Component: Verifier ()
Version: unspecified
Hardware: PC Mac OS
: Normal enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
Depends on:
Reported: 2013-01-14 08:16 UTC by Marek Safar
Modified: 2017-10-04 06:02 UTC (History)
4 users (show)

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

test (3.00 KB, application/x-msdownload)
2013-01-14 08:16 UTC, Marek Safar

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 for Bug 9545 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Marek Safar 2013-01-14 08:16:47 UTC
Created attachment 3211 [details]


Unhandled Exception: System.TypeLoadException: Method 'IA.f' on type 'A' from as
sembly 'test-996, Version=, Culture=neutral, PublicKeyToken=null' tried t
o explicitly implement an interface method with weaker type parameter constraint

Comment 1 Rodrigo Kumpera 2013-05-02 08:22:11 UTC
Ouch! This one is really really hard.

How do I check if a given set of constraints is weaker than another?
Comment 2 Marek Safar 2013-05-02 08:44:07 UTC

I think by weaker they mean is not as restrictive as the other type parameter which is quite simple for non-inflated versions (you just match set of ifaces+base type) but it's more complicated for inflated type parameters. C# implementation is in TypeParameterSpec::HasSameConstraintsImplementation and it should match to runtime checks and vice versa I think.
Comment 3 Rodrigo Kumpera 2017-10-03 20:07:30 UTC
This is really really complex and virtual generic method constraints are contravariant.

I'm moving this down to enhancement as it would be a huge time sink to implement it.