Bladeren bron

2007-07-19 Atsushi Enomoto <[email protected]>

	* MonoMethod.cs : ToString() did not show correct return type when
	  it is generic.

	* MethodInfoTest.cs : added ToString() test for generic return type.


svn path=/trunk/mcs/; revision=82268
Atsushi Eno 18 jaren geleden
bovenliggende
commit
b1879f67db

+ 5 - 0
mcs/class/corlib/System.Reflection/ChangeLog

@@ -1,3 +1,8 @@
+2007-07-19  Atsushi Enomoto  <[email protected]>
+
+	* MonoMethod.cs : ToString() did not show correct return type when
+	  it is generic.
+
 2007-07-15  Zoltan Varga  <[email protected]>
 
 	* FieldInfo.cs: Implement GetOptional/RequiredCustomModifiers ().

+ 4 - 5
mcs/class/corlib/System.Reflection/MonoMethod.cs

@@ -240,11 +240,10 @@ namespace System.Reflection {
 
 		public override string ToString () {
 			StringBuilder sb = new StringBuilder ();
-			if (ReturnType.IsClass && ReturnType.Namespace != String.Empty) {
-				sb.Append (ReturnType.Namespace);
-				sb.Append (".");
-			}
-			sb.Append (ReturnType.Name);
+			if (ReturnType.IsClass)
+				sb.Append (ReturnType.ToString ());
+			else
+				sb.Append (ReturnType.Name);
 			sb.Append (" ");
 			sb.Append (Name);
 #if NET_2_0 || BOOTSTRAP_NET_2_0

+ 4 - 0
mcs/class/corlib/Test/System.Reflection/ChangeLog

@@ -1,3 +1,7 @@
+2007-07-19  Atsushi Enomoto  <[email protected]>
+
+	* MethodInfoTest.cs : added ToString() test for generic return type.
+
 2007-07-09  Mark Probst  <[email protected]>
 
 	* AssemblyTest.cs: Enabled test for bug 78465.

+ 9 - 0
mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs

@@ -193,6 +193,15 @@ namespace MonoTests.System.Reflection
 				this.GetType ().GetMethod ("HeyHey").ToString ());
 		}
 
+#if NET_2_0
+		[Test]
+		public void ToStringGenericMethod ()
+		{
+			Assert.AreEqual ("System.Collections.ObjectModel.ReadOnlyCollection`1[T] AsReadOnly[T](.T[])",
+				typeof (Array).GetMethod ("AsReadOnly").ToString ());
+		}
+#endif
+
 		class GBD_A         { public virtual     void f () {} }
 		class GBD_B : GBD_A { public override    void f () {} }
 		class GBD_C : GBD_B { public override    void f () {} }