Bug 319394 (MONO76551) - [GMCS] missing "class" constraints on generic method IL
Summary: [GMCS] missing "class" constraints on generic method IL
Status: RESOLVED FIXED
Alias: MONO76551
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-25 18:28 UTC by Atsushi Enomoto
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:36:15 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".