[corlib] BaseType of by-ref types is null
authorMarek Safar <marek.safar@gmail.com>
Thu, 5 Mar 2015 17:40:36 +0000 (18:40 +0100)
committerMarek Safar <marek.safar@gmail.com>
Thu, 5 Mar 2015 17:41:19 +0000 (18:41 +0100)
mcs/class/corlib/Test/System/TypeTest.cs
mono/metadata/icall.c

index 1979a74c7e5bcf4f00a4ff92549271f7c890b9be..9d5b93f7b25bf1d5116f5014d8de7ecbbc14bf8a 100644 (file)
@@ -367,9 +367,10 @@ namespace MonoTests.System
 
                        // Tests for byref types
                        Type paramType = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic).GetParameters () [0].ParameterType;
-                       Assert.IsTrue (!paramType.IsSubclassOf (typeof (ValueType)), "#02");
-                       //Assert.IsTrue (paramType.IsSubclassOf (typeof (Object)), "#03");
-                       Assert.IsTrue (!paramType.IsSubclassOf (paramType), "#04");
+                       Assert.IsFalse (paramType.IsSubclassOf (typeof(ValueType)), "#02");
+                       Assert.IsNull (paramType.BaseType, "#02-b");
+                       Assert.IsTrue (paramType.IsSubclassOf (typeof (Object)), "#03");
+                       Assert.IsFalse (paramType.IsSubclassOf (paramType), "#04");
                }
 
                [Test]
@@ -3197,7 +3198,7 @@ namespace MonoTests.System
                                obj = GetType ().GetMember ("DummyMember", memtype,
                                                BindingFlags.Public | BindingFlags.Instance);
                                Assert.AreEqual (testtype.GetHashCode (), obj.GetType ().GetHashCode (),
-                                               "Expected " + testtype.FullName);
+                                               "Expected #" + i + " " + testtype.FullName);
                        }
 
                }
index b94dc2bc8fa32a1e77466e7169269f0eeea1f1c2..c9680c87329884ef20b1a536d001bf6c06ea3ceb 100644 (file)
@@ -2195,6 +2195,9 @@ ves_icall_MonoType_GetElementType (MonoReflectionType *type)
 ICALL_EXPORT MonoReflectionType*
 ves_icall_get_type_parent (MonoReflectionType *type)
 {
+       if (type->type->byref)
+               return NULL;
+
        MonoClass *class = mono_class_from_mono_type (type->type);
        return class->parent ? mono_type_get_object (mono_object_domain (type), &class->parent->byval_arg): NULL;
 }