Bugzilla – Bug 319333
[GMCS] gmcs emits extraneous base interfaces as generic parameter constraints
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by atsushi@ximian.com 2005-10-19 14:20:59 MST ---- The code below shows all of the generic parameter constraints for a generic argument of a generic method. using System; using System.Reflection; public interface IFoo : ICloneable {} public class Test { public void Foo<T> () where T : IFoo {} public static void Main () { foreach (Type t in typeof (Test).GetMethod ("Foo") .GetGenericArguments () [0] // T .GetGenericParameterConstraints ()) Console.WriteLine (t); } } Actual Results: When it is compiled with gmcs and run, it outputs "IFoo" and "ICloneable". Expected Results: With csc, it only outputs "IFoo". How often does this happen? consistently. Additional Information: It is not a runtime/classlib matter but gmcs matter (gmcs-compiled binary shows ICloneable on .NET). ---- Additional Comments From martin@ximian.com 2005-10-24 03:56:37 MST ---- Dammit - another such case where the spec is inconsistent: classes do list all interfaces they implement (including inherited interfaces), but type parameter constraints do not. ---- Additional Comments From martin@ximian.com 2005-10-24 04:30:34 MST ---- Fixed in SVN. Unknown operating system unknown. Setting to default OS "Other".