[Mono-bugs] [Bug 76551][Nor] New - [GMCS] missing "class" constraints on generic method IL

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Oct 25 11:28:41 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by atsushi at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=76551

--- shadow/76551	2005-10-25 11:28:41.000000000 -0400
+++ shadow/76551.tmp.3825	2005-10-25 11:28:41.000000000 -0400
@@ -0,0 +1,72 @@
+Bug#: 76551
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] missing "class" constraints on generic method IL
+
+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.


More information about the mono-bugs mailing list