Bug 9545

Summary: Explicitly implement an interface method with weaker type parameter constraint
Product: [Mono] Runtime Reporter: Marek Safar <masafa>
Component: VerifierAssignee: Bugzilla <bugzilla>
Status: CONFIRMED ---    
Severity: enhancement CC: aleksey, ludovic, mono-bugs+mono, mono-bugs+runtime
Priority: Normal    
Version: unspecified   
Target Milestone: Future Cycle (TBD)   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: test

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.