[Mono-list] Fix to System.MonoType.cs for issue 28582

Tim Coleman tim@timcoleman.com
Tue, 6 Aug 2002 11:55:58 -0400


Here's a patch for System.MonoType.cs which should fix
issue 28582 that I submitted on the weekend.

Before, there was no comparison of parameters as noted in
a fixme comment.  Now, it compares the parameters one-by-one
and if they don't match, a flag is set to false and the loop
is continued.  Otherwise, the return value is set.

This will prevent the bogus AmbiguousMatchException from
occurring unnecessarily.

Index: MonoType.cs
===================================================================
RCS file: /cvs/public/mcs/class/corlib/System/MonoType.cs,v
retrieving revision 1.23
diff -u -u -r1.23 MonoType.cs
--- MonoType.cs 18 Jul 2002 12:48:55 -0000      1.23
+++ MonoType.cs 6 Aug 2002 15:51:45 -0000
@@ -153,10 +153,22 @@
                                                        continue;

                                        if (types.Length > 0) {
-                                               if (info.GetIndexParameters().Length != types.Length)
+                                               ParameterInfo[] parameterInfo = info.GetIndexParameters ();
+
+                                               if (parameterInfo.Length != types.Length)
+                                                       continue;
+
+                                               int i;
+                                               bool match = true;
+
+                                               for (i = 0; i < types.Length; i += 1)
+                                                       if (parameterInfo [i].ParameterType != types [i]) {
+                                                               match = false;
+                                                               break;
+                                                       }
+
+                                               if (!match)
                                                        continue;
-
-                                               // fixme: compare parameters
                                        }

                                        if (null != ret)

-- 
Tim Coleman <tim@timcoleman.com>                       [43.28 N 80.31 W]
BMath, Honours Combinatorics and Optimization, University of Waterloo
"Under capitalism, man exploits man.  Under communism, it's just the
 opposite." -- J.K. Galbraith