Reflect latest generics API changes in the August CTP.
authorMartin Baulig <martin@novell.com>
Mon, 5 Sep 2005 15:03:33 +0000 (15:03 -0000)
committerMartin Baulig <martin@novell.com>
Mon, 5 Sep 2005 15:03:33 +0000 (15:03 -0000)
svn path=/trunk/mcs/; revision=49476

20 files changed:
mcs/bmcs/ecore.cs
mcs/bmcs/generic.cs
mcs/class/Mono.C5/Builder.cs
mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs
mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs
mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs
mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
mcs/class/corlib/System.Reflection/ChangeLog
mcs/class/corlib/System.Reflection/GenericParameterAttributes.cs
mcs/class/corlib/System.Reflection/MethodBase.cs
mcs/class/corlib/System.Reflection/MonoMethod.cs
mcs/class/corlib/System.Reflection/TypeDelegator.cs
mcs/class/corlib/System/ChangeLog
mcs/class/corlib/System/MonoType.cs
mcs/class/corlib/System/Type.cs
mcs/gmcs/anonymous.cs
mcs/gmcs/ecore.cs
mcs/gmcs/generic.cs
mcs/tools/monop/ChangeLog
mcs/tools/monop/outline.cs

index 51ca97ab8f19dc831396befd7e65866feed728a4..5557605ecfe79b02544524f33aedee850d6a4d2b 100644 (file)
@@ -2992,7 +2992,7 @@ namespace Mono.CSharp {
                                if (gen_params.Length != atypes.Length)
                                        continue;
 
-                               list.Add (mi.BindGenericParameters (atypes));
+                               list.Add (mi.MakeGenericMethod (atypes));
                        }
 
                        if (list.Count > 0) {
index c737f85ac78e79ce5875d91d58bcc3121536b3be..25a3a962c6cf338022ea75bce596661efc4b54a6 100644 (file)
@@ -33,7 +33,7 @@ namespace Mono.CSharp {
                }
 
                public bool HasValueTypeConstraint {
-                       get { return (Attributes & GenericParameterAttributes.ValueTypeConstraint) != 0; }
+                       get { return (Attributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; }
                }
 
                public virtual bool HasClassConstraint {
@@ -195,7 +195,7 @@ namespace Mono.CSharp {
                                        if (sc == SpecialConstraint.ReferenceType)
                                                attrs |= GenericParameterAttributes.ReferenceTypeConstraint;
                                        else
-                                               attrs |= GenericParameterAttributes.ValueTypeConstraint;
+                                               attrs |= GenericParameterAttributes.NotNullableValueTypeConstraint;
                                        continue;
                                }
 
@@ -1733,7 +1733,7 @@ namespace Mono.CSharp {
                        if (tc != null)
                                return tc.IsGeneric ? tc.CountTypeParameters : 0;
                        else
-                               return t.HasGenericArguments ? t.GetGenericArguments ().Length : 0;
+                               return t.IsGenericType ? t.GetGenericArguments ().Length : 0;
                }
 
                public static Type[] GetTypeArguments (Type t)
@@ -2171,7 +2171,7 @@ namespace Mono.CSharp {
                                if (infered_types [i] == null)
                                        return false;
 
-                       method = method.BindGenericParameters (infered_types);
+                       method = method.MakeGenericMethod (infered_types);
                        return true;
                }
 
@@ -2241,7 +2241,7 @@ namespace Mono.CSharp {
                        if (!InferTypeArguments (param_types, arg_types, infered_types))
                                return false;
 
-                       method = method.BindGenericParameters (infered_types);
+                       method = method.MakeGenericMethod (infered_types);
                        return true;
                }
 
@@ -2269,7 +2269,7 @@ namespace Mono.CSharp {
                        if (!InferTypeArguments (param_types, arg_types, infered_types))
                                return false;
 
-                       method = method.BindGenericParameters (infered_types);
+                       method = method.MakeGenericMethod (infered_types);
                        return true;
                }
 
index a4ad1080365fa64bf1ca2b8a0cef7dafd43d7b11..feb2981baed5f2478b9a901527143524cfb2e8b7 100644 (file)
@@ -161,7 +161,7 @@ namespace C5.HasherBuilder
         {\r
             Type t = typeof(T);\r
 \r
-            if (!t.HasGenericArguments)\r
+            if (!t.IsGenericType)\r
             {\r
                 if (t.Equals(typeof(int)))\r
                     return (IHasher<T>)(new IntHasher());\r
index 0908c13d5fe07ca2c16e645d5a14d3e37092d410..f315a06890ce6c9eba0016c3905acbe444cdd421 100644 (file)
@@ -360,13 +360,6 @@ namespace System.Reflection.Emit {
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
-               public override bool HasGenericArguments {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
                [MonoTODO]
                public override bool ContainsGenericParameters {
                        get {
index 2ff5a516819362fab70ca569efd49f3ab330c126..5b145956d58a64b6f9119e1b57c295b9f1131809 100644 (file)
@@ -316,10 +316,6 @@ namespace System.Reflection.Emit
                        throw not_supported ();
                }
 
-               public override bool HasGenericArguments {
-                       get { return false; }
-               }
-
                public override bool ContainsGenericParameters {
                        get { return true; }
                }
index b2cd75262f2535767291b0fa83c86c50ce37b628..adc42aef7fe73432838385913c8db0c5824b12ca 100644 (file)
@@ -461,7 +461,7 @@ namespace System.Reflection.Emit {
 
 #if NET_2_0 || BOOTSTRAP_NET_2_0
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public override extern MethodInfo BindGenericParameters (Type [] types);
+               public override extern MethodInfo MakeGenericMethod (Type [] types);
 
                public override bool Mono_IsInflatedMethod {
                        get {
index cef949a0f83d43e377017481ce142aec8ae27add..2ec16ac570c70b74b95117319ff2db2ba57ce96a 100644 (file)
@@ -1468,12 +1468,6 @@ namespace System.Reflection.Emit {
                        return base.GetGenericTypeDefinition ();
                }
 
-               public override bool HasGenericArguments {
-                       get {
-                               return generic_params != null;
-                       }
-               }
-
                public override bool ContainsGenericParameters {
                        get {
                                return generic_params != null;
index 7aca1630d8c2df65feef5c69ae049cd004aae89b..1b97d0325a554e4746d725dd22940dac20ad3566 100644 (file)
@@ -1,3 +1,12 @@
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       Reflect latest API changes in the August CTP.
+
+       * GenericParameterAttributes.cs: Here.
+
+       * MethodBase.cs (MethodBase.BindGenericParameters): Renamed to
+       MakeGenericMethod().    
+
 2005-09-05  Martin Baulig  <martin@ximian.com>
 
        * Assembly.cs (MonoDebugger_GetMethodToken): Don't take an
index e8836f2e23d23aabe08e78ac80e9b2ba3de1ebfb..ed092d585aac0170db4b858da42796498a40c218 100644 (file)
@@ -37,19 +37,18 @@ namespace System.Reflection
        [Flags]
        public enum GenericParameterAttributes
        {
-               NonVariant                      = 0,
                Covariant                       = 1,
                Contravariant                   = 2,
 
                VarianceMask                    = Covariant | Contravariant,
 
-               NoSpecialConstraint             = 0,
+               None                            = 0,
                ReferenceTypeConstraint         = 4,
-               ValueTypeConstraint             = 8,
+               NotNullableValueTypeConstraint  = 8,
                DefaultConstructorConstraint    = 16,
 
                SpecialConstraintMask           = 
-               ReferenceTypeConstraint | ValueTypeConstraint | DefaultConstructorConstraint
+               ReferenceTypeConstraint | NotNullableValueTypeConstraint | DefaultConstructorConstraint
        }
 }
 #endif
index f7471107802c361a681a63a70be6138788f994f6..ab282a2b469f7534895898098577c0f3fb7bae2e 100644 (file)
@@ -177,9 +177,9 @@ namespace System.Reflection {
                }
 
 #if NET_2_0 || BOOTSTRAP_NET_2_0
-               public virtual MethodInfo BindGenericParameters (Type [] types)
+               public virtual MethodInfo MakeGenericMethod (Type [] types)
                {
-                       throw new NotSupportedException ();
+                       throw new NotSupportedException (this.GetType().ToString ());
                }
 
                public virtual Type [] GetGenericArguments ()
index 263e4d16844da8c5839e2426b328d6748a09d743..d8ae01301c1895734ca392c6db494a3f93608acd 100644 (file)
@@ -253,7 +253,7 @@ namespace System.Reflection {
 
 #if NET_2_0 || BOOTSTRAP_NET_2_0
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public override extern MethodInfo BindGenericParameters (Type [] types);
+               public override extern MethodInfo MakeGenericMethod (Type [] types);
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public override extern Type [] GetGenericArguments ();
index a2d644bbfa2f11cb2392cd7c034081a3803c1dd1..5dbb01d786e8e4c7f06532d06e69ee08fe9732d8 100644 (file)
@@ -260,11 +260,6 @@ namespace System.Reflection {
                        throw new NotImplementedException ();
                }
 
-               public override bool HasGenericArguments {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
 
                public override bool ContainsGenericParameters {
                        get {
index 2b8750367311430f2c99d8e1d00172ab94a068af..001c76450adcf37d54cefb273e27a5e1abd78784 100644 (file)
@@ -1,3 +1,10 @@
+2005-09-05  Martin Baulig  <martin@ximian.com>
+
+       Reflect latest API changes in the August CTP.
+
+       * Type.cs (Type.HasGenericArguments): Removed.
+       (Type.BindGenericParameters): Renamed to MakeGenericType().
+
 2005-09-01  Atsushi Enomoto  <atsushi@ximian.com>
 
        * DateTime.cs : another idiotic COM dependent format.
index 7c145c730d73245c98768a31966493c674c1dbc5..ce5cb12358e3d9103996ac5d8f92ae0eb70f25d2 100644 (file)
@@ -568,17 +568,12 @@ namespace System
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern override Type [] GetGenericArguments ();
 
-               public extern override bool HasGenericArguments {
-                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
-                       get;
-               }
-
                public override bool ContainsGenericParameters {
                        get {
                                if (IsGenericParameter)
                                        return true;
 
-                               if (HasGenericArguments) {
+                               if (IsGenericType) {
                                        foreach (Type arg in GetGenericArguments ())
                                                if (arg.ContainsGenericParameters)
                                                        return true;
index 9a83f152b806cd18087f7ae15f5e6be09de1a60f..7aca1c950d2aa82683a5f01c6d15c2e35f3cf198 100644 (file)
@@ -1081,10 +1081,6 @@ namespace System {
 #if NET_2_0 || BOOTSTRAP_NET_2_0
                public abstract Type[] GetGenericArguments ();
 
-               public abstract bool HasGenericArguments {
-                       get;
-               }
-
                public abstract bool ContainsGenericParameters {
                        get;
                }
@@ -1117,16 +1113,7 @@ namespace System {
                }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               static extern Type BindGenericParameters (Type gt, Type [] types);
-
-#if NET_2_0
-               [ComVisible (true)]
-               [ObsoleteAttribute("BindGenericParameters() has been deprecated. Please use MakeGenericType() instead - this will be removed before Whidbey ships.")]
-#endif         
-               public Type BindGenericParameters (Type [] types)
-               {
-                       return MakeGenericType (types);
-               }
+               static extern Type MakeGenericType (Type gt, Type [] types);
 
                public virtual Type MakeGenericType (params Type[] types)
                {
@@ -1136,7 +1123,7 @@ namespace System {
                                if (t == null)
                                        throw new ArgumentNullException ("types");
                        }
-                       Type res = BindGenericParameters (this, types);
+                       Type res = MakeGenericType (this, types);
                        if (res == null)
                                throw new TypeLoadException ();
                        return res;
index f998626c4e0a9701c307aa401a17200296941f12..b0b3cce0d95047ec534fdc0b49c80b8ab3396aa3 100644 (file)
@@ -364,7 +364,7 @@ namespace Mono.CSharp {
                {
                        MethodInfo builder = method.MethodData.MethodBuilder;
                        if (TypeArguments != null)
-                               return builder.BindGenericParameters (TypeArguments);
+                               return builder.MakeGenericMethod (TypeArguments);
                        else
                                return builder;
                }
index 28ce959dd72b7d675f0c09b3760d0ecce39ee9cf..3d4786437d3a1dc56537c96eb66eb7a1f6286b47 100644 (file)
@@ -2857,7 +2857,7 @@ namespace Mono.CSharp {
                                if (gen_params.Length != atypes.Length)
                                        continue;
 
-                               list.Add (mi.BindGenericParameters (atypes));
+                               list.Add (mi.MakeGenericMethod (atypes));
                        }
 
                        if (list.Count > 0) {
index 204733fe9be35205ce1b099879accf55b3e4dde3..fab459b36ed6e17fc412219de50ecb653a6fad04 100644 (file)
@@ -33,7 +33,7 @@ namespace Mono.CSharp {
                }
 
                public bool HasValueTypeConstraint {
-                       get { return (Attributes & GenericParameterAttributes.ValueTypeConstraint) != 0; }
+                       get { return (Attributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; }
                }
 
                public virtual bool HasClassConstraint {
@@ -199,7 +199,7 @@ namespace Mono.CSharp {
                                        if (sc == SpecialConstraint.ReferenceType)
                                                attrs |= GenericParameterAttributes.ReferenceTypeConstraint;
                                        else
-                                               attrs |= GenericParameterAttributes.ValueTypeConstraint;
+                                               attrs |= GenericParameterAttributes.NotNullableValueTypeConstraint;
                                        continue;
                                }
 
@@ -1691,7 +1691,7 @@ namespace Mono.CSharp {
                        if (tc != null)
                                return tc.IsGeneric ? tc.CountTypeParameters : 0;
                        else
-                               return t.HasGenericArguments ? t.GetGenericArguments ().Length : 0;
+                               return t.IsGenericType ? t.GetGenericArguments ().Length : 0;
                }
 
                public static Type[] GetTypeArguments (Type t)
@@ -2127,7 +2127,7 @@ namespace Mono.CSharp {
                                if (infered_types [i] == null)
                                        return false;
 
-                       method = method.BindGenericParameters (infered_types);
+                       method = method.MakeGenericMethod (infered_types);
                        return true;
                }
 
@@ -2198,7 +2198,7 @@ namespace Mono.CSharp {
                        if (!InferTypeArguments (param_types, arg_types, infered_types))
                                return false;
 
-                       method = method.BindGenericParameters (infered_types);
+                       method = method.MakeGenericMethod (infered_types);
                        return true;
                }
 
@@ -2226,7 +2226,7 @@ namespace Mono.CSharp {
                        if (!InferTypeArguments (param_types, arg_types, infered_types))
                                return false;
 
-                       method = method.BindGenericParameters (infered_types);
+                       method = method.MakeGenericMethod (infered_types);
                        return true;
                }
 
index cfea4c0e9fed0c53686edae94de78f6627d1d336..fc91d4594b925fd80b4a25809c0e2ebd524295aa 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-05  Michal Moskal  <malekith@nemerle.org>
+       
+       * outline.cs: Use new names of the GenericParameterAttributes enum.
+
 2005-08-19  Ben Maurer  <bmaurer@novell.com>
 
        * outline.cs:
index 63c08b7e3786f98fd462a47c786ace7433c4d1a0..291fd239b15f5574bb1391adb082e11a970ae46b 100644 (file)
@@ -700,7 +700,7 @@ public class Outline {
                        GenericParameterAttributes attrs = t.GenericParameterAttributes & GenericParameterAttributes.SpecialConstraintMask;
                        GenericParameterAttributes [] interesting = {
                                GenericParameterAttributes.ReferenceTypeConstraint,
-                               GenericParameterAttributes.ValueTypeConstraint,
+                               GenericParameterAttributes.NotNullableValueTypeConstraint,
                                GenericParameterAttributes.DefaultConstructorConstraint
                        };
                        
@@ -735,7 +735,7 @@ public class Outline {
                                case GenericParameterAttributes.ReferenceTypeConstraint:
                                        o.Write ("class");
                                        break;
-                               case GenericParameterAttributes.ValueTypeConstraint:
+                               case GenericParameterAttributes.NotNullableValueTypeConstraint:
                                        o.Write ("struct");
                                        break;
                                case GenericParameterAttributes.DefaultConstructorConstraint: