2005-04-13 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Wed, 13 Apr 2005 08:06:20 +0000 (08:06 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Wed, 13 Apr 2005 08:06:20 +0000 (08:06 -0000)
* doc.cs : detect ambiguous reference to overloaded members.
  Fixed bug #71603. MS 1.1 csc does not detect it.

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

mcs/mcs/ChangeLog
mcs/mcs/doc.cs

index a44ed9481c0270c6d76ab5fcd8aa369fc899b073..7ea9c2aa33371588feaf37c7499e3763bb7e625a 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-13  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * doc.cs : detect ambiguous reference to overloaded members.
+         Fixed bug #71603. MS 1.1 csc does not detect it.
+
 2005-04-13  Atsushi Enomoto  <atsushi@ximian.com>
 
        * doc.cs : delegates must not be referenced with parameters.
index f64a600302bf0c22f629a0970084880fc48f8718..8d00f6da0df6279a1197e47387b1e3792d62360c 100644 (file)
@@ -330,6 +330,7 @@ namespace Mono.CSharp {
                        Type parent = FindDocumentedType (mc, identifier.Substring (0, index), ds, cref);
                        if (parent == null)
                                return null;
+                       // no need to detect warning 419 here
                        return FindDocumentedMember (mc, parent,
                                identifier.Substring (index + 1),
                                emptyParamList,
@@ -351,8 +352,11 @@ namespace Mono.CSharp {
                                BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance,
                                MethodSignature.method_signature_filter,
                                msig);
-                       if (mis.Length > 0)
+                       if (mis.Length > 0) {
+                               if (mis.Length > 1)
+                                       warningType = 419;
                                return mis [0];
+                       }
 
                        if (paramList.Length == 0) {
                                // search for fields/events etc.
@@ -361,7 +365,11 @@ namespace Mono.CSharp {
                                        BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance,
                                        Type.FilterName,
                                        memberName);
-                               return (mis.Length > 0) ? mis [0] : null;
+                               if (mis.Length == 0)
+                                       return null;
+                               if (mis.Length > 1)
+                                       warningType = 419;
+                               return mis [0];
                        }
 
                        // search for operators (whose parameters exactly
@@ -585,7 +593,9 @@ namespace Mono.CSharp {
                                int warnResult;
                                if (type != null) {
                                        MemberInfo mi = FindDocumentedMember (mc, type, memberName, parameterTypes, ds, out warnResult, cref);
-                                       if (warnResult > 0)
+                                       if (warnResult == 419)
+                                               Report419 (mc, memberName);
+                                       else if (warnResult > 0)
                                                return;
                                        if (mi != null) {
                                                xref.SetAttribute ("cref", GetMemberDocHead (mi.MemberType) + type.FullName.Replace ("+", ".") + "." + memberName + parameters);
@@ -596,7 +606,9 @@ namespace Mono.CSharp {
                        else {
                                int warnResult;
                                MemberInfo mi = FindDocumentedMember (mc, ds.TypeBuilder, name, parameterTypes, ds, out warnResult, cref);
-                               if (warnResult > 0)
+                               if (warnResult == 419)
+                                       Report419 (mc, name);
+                               else if (warnResult > 0)
                                        return;
                                if (mi != null) {
                                        xref.SetAttribute ("cref", GetMemberDocHead (mi.MemberType) + ds.TypeBuilder.FullName.Replace ("+", ".") + "." + name);
@@ -609,6 +621,11 @@ namespace Mono.CSharp {
                        xref.SetAttribute ("cref", "!:" + name);
                }
 
+               static void Report419 (MemberCore mc, string memberName)
+               {
+                       Report.Warning (419, 3, mc.Location, "Ambiguous member specification in cref attribute: '{0}'. Check overloaded members and supply exact parameters.", memberName);
+               }
+
                //
                // Get a prefix from member type for XML documentation (used
                // to formalize cref target name).