2009-07-28 Rodrigo Kumpera <rkumpera@novell.com>
authorRodrigo Kumpera <kumpera@gmail.com>
Wed, 29 Jul 2009 02:04:15 +0000 (02:04 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Wed, 29 Jul 2009 02:04:15 +0000 (02:04 -0000)
* GenericTypeParameterBuilder.cs: SetBaseTypeConstraint with
null argument is the same as passing typeof (object).

2009-07-28 Rodrigo Kumpera  <rkumpera@novell.com>

* GenericTypeParameterBuilderTest.cs: Test for BaseType
and SetBaseTypeConstraint.

svn path=/trunk/mcs/; revision=138911

mcs/class/corlib/System.Reflection.Emit/ChangeLog
mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs
mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
mcs/class/corlib/Test/System.Reflection.Emit/GenericTypeParameterBuilderTest.cs

index a39bfdbf20aa84c589e6d759d0ea3feb21557159..167e2b36f0e319f04735efa0a0c140bce9093a9a 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-28 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * GenericTypeParameterBuilder.cs: SetBaseTypeConstraint with
+       null argument is the same as passing typeof (object).
+
 2009-07-28 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * DerivedTypes.cs (ArrayType): Special case vector arrays using zero
index 0d1a2a012453a3a70e48175cb280326a99b7f98c..15e2f6fdb8c19013f54a876ca78e4da8200dd0ff 100644 (file)
@@ -56,7 +56,7 @@ namespace System.Reflection.Emit
 
                public void SetBaseTypeConstraint (Type baseTypeConstraint)
                {
-                       this.base_type = baseTypeConstraint;
+                       this.base_type = baseTypeConstraint ?? typeof (object);
                }
 
                [ComVisible (true)]
index e48fe2a5a28d090141431377d6093cf8ce281111..d43a866e07396629984201943c24bc3e48a71ff1 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-28 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * GenericTypeParameterBuilderTest.cs: Test for BaseType
+       and SetBaseTypeConstraint.
+
 2009-07-28 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * DerivedTypesTests.cs: Add test for the distinction between
index 1db950b89e9ae8cc9388bf5d554a9b96f168b114..d39ae8e3ad02b42200b916f86e62dee147eb0f49 100644 (file)
@@ -303,6 +303,16 @@ namespace MonoTests.System.Reflection.Emit
                        Assert.IsTrue (res.IsPointer, "#2");
                }
 
+               [Test]
+               public void SetBaseTypeConstraintWithNull ()
+               {
+                       TypeBuilder tb = module.DefineType ("dd.test", TypeAttributes.Public);
+                       var gparam = tb.DefineGenericParameters ("A", "B")[1];
+
+                       Assert.IsNull (gparam.BaseType, "#1");
+                       gparam.SetBaseTypeConstraint (null);
+                       Assert.AreEqual (typeof (object), gparam.BaseType, "#2");
+               }
 
                [Test]
                public void GenericTypeMembers ()