Author: atsushi
Date: 2006-01-15 23:26:00 -0500 (Sun, 15 Jan 2006)
New Revision: 55618

Added:
   trunk/mcs/tests/gtest-xml-1-ref.xml
   trunk/mcs/tests/gtest-xml-1.cs
Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/doc.cs
   trunk/mcs/gmcs/typemanager.cs
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/doc.cs
   trunk/mcs/mcs/typemanager.cs
   trunk/mcs/tests/
   trunk/mcs/tests/ChangeLog
Log:
2006-01-16  Atsushi Enomoto  <[EMAIL PROTECTED]>

        in mcs:
        * typemanager.cs : added IsGenericParameter(). In mcs it always
          return false.
        * doc.cs : for generic parameters, use GenericParameterPosition,
          not FullName.

        in gmcs:
        * typemanager.cs : added IsGenericParameter(). In gmcs it returns
          Type.IsGenericParameter(). Fixed bug #77183.
        * doc.cs : it is now identical to doc.cs in mcs.

        in tests:
        * gtest-xml-1-ref.xml, gtest-xml-1.cs : test for bug #77183.



Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2006-01-16 04:08:23 UTC (rev 55617)
+++ trunk/mcs/gmcs/ChangeLog    2006-01-16 04:26:00 UTC (rev 55618)
@@ -1,3 +1,9 @@
+2006-01-16  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * typemanager.cs : added IsGenericParameter(). In gmcs it returns
+         Type.IsGenericParameter(). Fixed bug #77183.
+       * doc.cs : it is now identical to doc.cs in mcs.
+
 2006-01-16  Martin Baulig  <[EMAIL PROTECTED]>
 
        * generic.cs (ConstraintChecker.CheckConstraint): Fix #77167.

Modified: trunk/mcs/gmcs/doc.cs
===================================================================
--- trunk/mcs/gmcs/doc.cs       2006-01-16 04:08:23 UTC (rev 55617)
+++ trunk/mcs/gmcs/doc.cs       2006-01-16 04:26:00 UTC (rev 55618)
@@ -9,6 +9,7 @@
 // (C) 2004 Novell, Inc.
 //
 //
+#if ! BOOTSTRAP_WITH_OLDLIB
 using System;
 using System.Collections;
 using System.Collections.Specialized;
@@ -697,7 +698,7 @@
                                // delegate must not be referenced with args
                                && (!type.IsSubclassOf (typeof 
(System.Delegate))
                                || parameterTypes == null)) {
-                               string result = type.FullName.Replace ("+", ".")
+                               string result = GetSignatureForDoc (type)
                                        + (bracePos < 0 ? String.Empty : 
signature.Substring (bracePos));
                                xref.SetAttribute ("cref", "T:" + result);
                                return; // a type
@@ -720,7 +721,7 @@
                                                // to get its name, since mi
                                                // could be from DeclaringType
                                                // for nested types.
-                                               xref.SetAttribute ("cref", 
GetMemberDocHead (mi.MemberType) + fm.Type.FullName.Replace ("+", ".") + "." + 
memberName + GetParametersFormatted (mi));
+                                               xref.SetAttribute ("cref", 
GetMemberDocHead (mi.MemberType) + GetSignatureForDoc (fm.Type) + "." + 
memberName + GetParametersFormatted (mi));
                                                return; // a member of a type
                                        }
                                }
@@ -736,7 +737,7 @@
                                        // to get its name, since mi
                                        // could be from DeclaringType
                                        // for nested types.
-                                       xref.SetAttribute ("cref", 
GetMemberDocHead (mi.MemberType) + fm.Type.FullName.Replace ("+", ".") + "." + 
name + GetParametersFormatted (mi));
+                                       xref.SetAttribute ("cref", 
GetMemberDocHead (mi.MemberType) + GetSignatureForDoc (fm.Type) + "." + name + 
GetParametersFormatted (mi));
                                        return; // local member name
                                }
                        }
@@ -785,7 +786,7 @@
                                if (i > 0)
                                        sb.Append (',');
                                Type t = parameters.ParameterType (i);
-                               sb.Append (t.FullName.Replace ('+', 
'.').Replace ('&', '@'));
+                               sb.Append (GetSignatureForDoc (t));
                        }
                        sb.Append (')');
                        return sb.ToString ();
@@ -851,7 +852,7 @@
                                StringBuilder psb = new StringBuilder ();
                                foreach (Parameter p in plist) {
                                        psb.Append (psb.Length != 0 ? "," : 
"(");
-                                       psb.Append (p.ExternalType 
().FullName.Replace ("+", ".").Replace ('&', '@'));
+                                       psb.Append (GetSignatureForDoc 
(p.ExternalType ()));
                                }
                                paramSpec = psb.ToString ();
                        }
@@ -866,13 +867,20 @@
                                switch (op.OperatorType) {
                                case Operator.OpType.Implicit:
                                case Operator.OpType.Explicit:
-                                       suffix = "~" + 
op.OperatorMethodBuilder.ReturnType.FullName.Replace ('+', '.');
+                                       suffix = "~" + GetSignatureForDoc 
(op.OperatorMethodBuilder.ReturnType);
                                        break;
                                }
                        }
                        return String.Concat (mc.DocCommentHeader, ds.Name, 
".", name, paramSpec, suffix);
                }
 
+               static string GetSignatureForDoc (Type type)
+               {
+                       return TypeManager.IsGenericParameter (type) ?
+                               "`" + type.GenericParameterPosition :
+                               type.FullName.Replace ("+", ".").Replace ('&', 
'@');
+               }
+
                //
                // Raised (and passed an XmlElement that contains the comment)
                // when GenerateDocComment is writing documentation expectedly.
@@ -1055,3 +1063,4 @@
                }
        }
 }
+#endif

Modified: trunk/mcs/gmcs/typemanager.cs
===================================================================
--- trunk/mcs/gmcs/typemanager.cs       2006-01-16 04:08:23 UTC (rev 55617)
+++ trunk/mcs/gmcs/typemanager.cs       2006-01-16 04:26:00 UTC (rev 55618)
@@ -2436,6 +2436,13 @@
                return target_list;
        }
 
+       // This method always return false for non-generic compiler,
+       // while Type.IsGenericParameter is returned if it is supported.
+       public static bool IsGenericParameter (Type type)
+       {
+               return type.IsGenericParameter;
+       }
+
 #region MemberLookup implementation
        
        //

Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2006-01-16 04:08:23 UTC (rev 55617)
+++ trunk/mcs/mcs/ChangeLog     2006-01-16 04:26:00 UTC (rev 55618)
@@ -1,3 +1,10 @@
+2006-01-16  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * typemanager.cs : added IsGenericParameter(). In mcs it always
+         return false.
+       * doc.cs : for generic parameters, use GenericParameterPosition,
+         not FullName.
+
 2006-01-12  Ben Maurer  <[EMAIL PROTECTED]>
 
        * expression.cs: Fix Console.WriteLine ((this = x).foo);

Modified: trunk/mcs/mcs/doc.cs
===================================================================
--- trunk/mcs/mcs/doc.cs        2006-01-16 04:08:23 UTC (rev 55617)
+++ trunk/mcs/mcs/doc.cs        2006-01-16 04:26:00 UTC (rev 55618)
@@ -9,7 +9,6 @@
 // (C) 2004 Novell, Inc.
 //
 //
-
 #if ! BOOTSTRAP_WITH_OLDLIB
 using System;
 using System.Collections;
@@ -31,7 +30,7 @@
        //
        // Support class for XML documentation.
        //
-       public class DocUtil
+       public static class DocUtil
        {
                // TypeContainer
 
@@ -699,7 +698,7 @@
                                // delegate must not be referenced with args
                                && (!type.IsSubclassOf (typeof 
(System.Delegate))
                                || parameterTypes == null)) {
-                               string result = type.FullName.Replace ("+", ".")
+                               string result = GetSignatureForDoc (type)
                                        + (bracePos < 0 ? String.Empty : 
signature.Substring (bracePos));
                                xref.SetAttribute ("cref", "T:" + result);
                                return; // a type
@@ -722,7 +721,7 @@
                                                // to get its name, since mi
                                                // could be from DeclaringType
                                                // for nested types.
-                                               xref.SetAttribute ("cref", 
GetMemberDocHead (mi.MemberType) + fm.Type.FullName.Replace ("+", ".") + "." + 
memberName + GetParametersFormatted (mi));
+                                               xref.SetAttribute ("cref", 
GetMemberDocHead (mi.MemberType) + GetSignatureForDoc (fm.Type) + "." + 
memberName + GetParametersFormatted (mi));
                                                return; // a member of a type
                                        }
                                }
@@ -738,7 +737,7 @@
                                        // to get its name, since mi
                                        // could be from DeclaringType
                                        // for nested types.
-                                       xref.SetAttribute ("cref", 
GetMemberDocHead (mi.MemberType) + fm.Type.FullName.Replace ("+", ".") + "." + 
name + GetParametersFormatted (mi));
+                                       xref.SetAttribute ("cref", 
GetMemberDocHead (mi.MemberType) + GetSignatureForDoc (fm.Type) + "." + name + 
GetParametersFormatted (mi));
                                        return; // local member name
                                }
                        }
@@ -787,7 +786,7 @@
                                if (i > 0)
                                        sb.Append (',');
                                Type t = parameters.ParameterType (i);
-                               sb.Append (t.FullName.Replace ('+', 
'.').Replace ('&', '@'));
+                               sb.Append (GetSignatureForDoc (t));
                        }
                        sb.Append (')');
                        return sb.ToString ();
@@ -853,7 +852,7 @@
                                StringBuilder psb = new StringBuilder ();
                                foreach (Parameter p in plist) {
                                        psb.Append (psb.Length != 0 ? "," : 
"(");
-                                       psb.Append (p.ExternalType 
().FullName.Replace ("+", ".").Replace ('&', '@'));
+                                       psb.Append (GetSignatureForDoc 
(p.ExternalType ()));
                                }
                                paramSpec = psb.ToString ();
                        }
@@ -868,13 +867,20 @@
                                switch (op.OperatorType) {
                                case Operator.OpType.Implicit:
                                case Operator.OpType.Explicit:
-                                       suffix = "~" + 
op.OperatorMethodBuilder.ReturnType.FullName.Replace ('+', '.');
+                                       suffix = "~" + GetSignatureForDoc 
(op.OperatorMethodBuilder.ReturnType);
                                        break;
                                }
                        }
                        return String.Concat (mc.DocCommentHeader, ds.Name, 
".", name, paramSpec, suffix);
                }
 
+               static string GetSignatureForDoc (Type type)
+               {
+                       return TypeManager.IsGenericParameter (type) ?
+                               type.Name :
+                               type.FullName.Replace ("+", ".").Replace ('&', 
'@');
+               }
+
                //
                // Raised (and passed an XmlElement that contains the comment)
                // when GenerateDocComment is writing documentation expectedly.
@@ -1057,5 +1063,4 @@
                }
        }
 }
-
 #endif

Modified: trunk/mcs/mcs/typemanager.cs
===================================================================
--- trunk/mcs/mcs/typemanager.cs        2006-01-16 04:08:23 UTC (rev 55617)
+++ trunk/mcs/mcs/typemanager.cs        2006-01-16 04:26:00 UTC (rev 55618)
@@ -2110,6 +2110,13 @@
        }
 
 
+       // This method always return false for non-generic compiler,
+       // while Type.IsGenericParameter is returned if it is supported.
+       public static bool IsGenericParameter (Type type)
+       {
+               return false;
+       }
+
 #region MemberLookup implementation
        
        //


Property changes on: trunk/mcs/tests
___________________________________________________________________
Name: svn:ignore
   - *.dll
*.exe
*.log
*.netmodule
xml-*.xml
test-471.xml
data.xml
casts.cs
boot-casts.out
dir-gmcs
dir-mcs
mcs-casts.out
semantic.cache
dummy.xml

   + *.dll
*.exe
*.log
*.netmodule
xml-*.xml
gxml-*.xml
test-471.xml
data.xml
casts.cs
boot-casts.out
dir-gmcs
dir-mcs
mcs-casts.out
semantic.cache
dummy.xml


Modified: trunk/mcs/tests/ChangeLog
===================================================================
--- trunk/mcs/tests/ChangeLog   2006-01-16 04:08:23 UTC (rev 55617)
+++ trunk/mcs/tests/ChangeLog   2006-01-16 04:26:00 UTC (rev 55618)
@@ -1,3 +1,7 @@
+2006-01-16  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * gtest-xml-1-ref.xml, gtest-xml-1.cs : test for bug #77183.
+
 2006-01-12  Ben Maurer  <[EMAIL PROTECTED]>
 
        * test-437.cs: New test for Console.WriteLine ((this = x).foo)

Added: trunk/mcs/tests/gtest-xml-1-ref.xml
===================================================================
--- trunk/mcs/tests/gtest-xml-1-ref.xml 2006-01-16 04:08:23 UTC (rev 55617)
+++ trunk/mcs/tests/gtest-xml-1-ref.xml 2006-01-16 04:26:00 UTC (rev 55618)
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<doc>
+    <assembly>
+        <name>gtest-xml-1</name>
+    </assembly>
+    <members>
+        <member name="T:GenericClass`1">
+            <summary>This file throws an error when compiled with XML 
documentation</summary>
+        </member>
+        <member name="M:GenericClass`1.#ctor(`0)">
+            <summary>This line caused bug #77183</summary>
+        </member>
+    </members>
+</doc>


Property changes on: trunk/mcs/tests/gtest-xml-1-ref.xml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/mcs/tests/gtest-xml-1.cs
===================================================================
--- trunk/mcs/tests/gtest-xml-1.cs      2006-01-16 04:08:23 UTC (rev 55617)
+++ trunk/mcs/tests/gtest-xml-1.cs      2006-01-16 04:26:00 UTC (rev 55618)
@@ -0,0 +1,19 @@
+// Compiler options: -doc:gxml-1.xml
+using System; 
+
+///<summary>This file throws an error when compiled with XML 
documentation</summary>
+public class GenericClass <gT>
+{
+    gT m_data; 
+
+    ///<summary>This line caused bug #77183</summary>
+    public GenericClass (gT Data)
+    {
+        m_data = Data; 
+    }
+}
+
+class Foo
+{
+    public static void Main () {}
+}


Property changes on: trunk/mcs/tests/gtest-xml-1.cs
___________________________________________________________________
Name: svn:eol-style
   + native

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to