Bugzilla – Bug 319394
[GMCS] missing "class" constraints on generic method IL
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by atsushi@ximian.com 2005-10-25 11:28:41 MST ---- gmcs does not emit GenericAttributes.ReferenceTypeConstraint for generic method constraint "class". using System; using System.Reflection; public abstract class Foo<T> where T : class { public abstract Foo<K> UseT<K> () where K : class; } public class Test { public static void Main () { MethodInfo mi = typeof (Foo<object>) .GetGenericTypeDefinition ().GetMethod ("UseT"); Console.WriteLine (mi); foreach (Type t in mi.GetGenericArguments ()) Console.WriteLine (":::{0} {1}", t, t.GenericParameterAttributes); } } Actual Results: .Foo`1 UseT() :::K None Expected Results: .net beta2 csc outputs: Foo`1[K] UseT[K]() :::K None, NoSpecialConstraint, ReferenceTypeConstraint How often does this happen? consistently. Additional Information: I'm not sure about other output differences (MethodInfo.ToString() and type.GenericAttributes.ToString()), but at least ReferenceTypeConstraint flag is significant. At least this ReferenceTypeConstraint problem is gmcs matter; The binary compiled by gmcs does not print ReferenceTypeConstraint on .NET 2.0 beta2. The binary compiled by csc prints the flag as expected. The GenericAttributes flag on generic type constraints are fine. ---- Additional Comments From atsushi@ximian.com 2005-10-25 11:29:48 MST ---- Maybe it should be directed to Martin. ---- Additional Comments From martin@ximian.com 2005-10-25 11:49:48 MST ---- Sure, I'll look at it right now. If there are any other bugs I can help you with, please lemme know. ---- Additional Comments From martin@ximian.com 2005-10-25 12:19:24 MST ---- Fixed in SVN. Unknown operating system unknown. Setting to default OS "Other".