Fix #73038.
[mono.git] / mcs / mcs / pending.cs
index 81cb2b7d67048a4d60653151e1572024c49ef3f0..98a4e9993eec4b4a0b9fb137bf6a577f7784202a 100644 (file)
@@ -102,8 +102,8 @@ namespace Mono.CSharp {
                                
                                mi = TypeContainer.FindMembers (
                                        current_type, MemberTypes.Method,
-                                       BindingFlags.Public | BindingFlags.Instance |
-                                       BindingFlags.DeclaredOnly,
+                                       BindingFlags.Public | BindingFlags.NonPublic |
+                                       BindingFlags.Instance | BindingFlags.DeclaredOnly,
                                        virtual_method_filter, null);
 
                                if (current_type == TypeManager.object_type)
@@ -175,7 +175,13 @@ namespace Mono.CSharp {
                                
                                int j = 0;
                                foreach (MethodInfo m in mi){
-                                       Type [] types = TypeManager.GetArgumentTypes (m);
+                                       Type [] types;
+                                       
+                                       // If there is a previous error, just ignore
+                                       if (m == null)
+                                               types = TypeManager.NoTypes;
+                                       else
+                                               types = TypeManager.GetArgumentTypes (m);
                                        
                                        pending_implementations [i].args [j] = types;
                                        j++;
@@ -468,19 +474,9 @@ namespace Mono.CSharp {
                        int top = args.Length;
                        ILGenerator ig = proxy.GetILGenerator ();
 
-                       ig.Emit (OpCodes.Ldarg_0);
-                       for (int i = 0; i < top; i++){
-                               switch (i){
-                               case 0:
-                                       ig.Emit (OpCodes.Ldarg_1); break;
-                               case 1:
-                                       ig.Emit (OpCodes.Ldarg_2); break;
-                               case 2:
-                                       ig.Emit (OpCodes.Ldarg_3); break;
-                               default:
-                                       ig.Emit (OpCodes.Ldarg, i + 1); break;
-                               }
-                       }
+                       for (int i = 0; i <= top; i++)
+                               ParameterReference.EmitLdArg (ig, i);
+
                        ig.Emit (OpCodes.Call, base_method);
                        ig.Emit (OpCodes.Ret);
 
@@ -545,16 +541,23 @@ namespace Mono.CSharp {
 
                                                if (pending_implementations [i].optional)
                                                        continue;
-                                               
+
+                                               Report.SymbolRelatedToPreviousError (mi);
                                                if (pending_implementations [i].found [j]) {
-                                                       string[] methodLabel = TypeManager.CSharpSignature (mi).Split ('.');
-                                                       Report.Error (536, container.Location,
-                                                                     "'{0}' does not implement interface member '{1}'. '{2}.{3}' " +
-                                                                     "is either static, not public, or has the wrong return type",
-                                                                     container.Name, TypeManager.CSharpSignature (mi),
-                                                                     container.Name, methodLabel[methodLabel.Length - 1]);
+                                                       if (mi.IsSpecialName) {
+                                                               string name = TypeManager.CSharpName (mi.DeclaringType) + '.' + mi.Name.Substring (4);
+                                                               Report.Error (551, container.Location, "Explicit interface implementation '{0}.{1}' is missing accessor '{1}'",
+                                                                       container.Name, name);
+                                                       } else {
+                                                               string[] methodLabel = TypeManager.CSharpSignature (mi).Split ('.');
+                                                               Report.Error (536, container.Location,
+                                                                       "'{0}' does not implement interface member '{1}'. '{2}.{3}' " +
+                                                                       "is either static, not public, or has the wrong return type",
+                                                                       container.Name, TypeManager.CSharpSignature (mi),
+                                                                       container.Name, methodLabel[methodLabel.Length - 1]);
+                                                       }
                                                }
-                                               else { 
+                                               else {
                                                        Report.Error (535, container.Location, "'{0}' does not implement interface member '{1}'",
                                                                container.Name, TypeManager.CSharpSignature (mi));
                                                }