Hi, Here I send a fix for a indexer bug in the inheritance. This fix is tested in mono 0.19 and it works. In the current mcs from cvs there is a problem with the Indexers but it is out of the file that I changed. The patch is for "expression.cs".
I send a testcase too. See you, Pedro -- Pedro Martinez Juliá \ [EMAIL PROTECTED] )| [EMAIL PROTECTED] / http://yoros.cjb.net Socio HispaLinux #311 Usuario Linux #275438 - http://counter.li.org GnuPG public information: pub 1024D/74F1D3AC Key fingerprint = 8431 7B47 D2B4 5A46 5F8E 534F 588B E285 74F1 D3AC
Index: expression.cs =================================================================== RCS file: /mono/mcs/mcs/expression.cs,v retrieving revision 1.396 diff -r1.396 expression.cs 6850a6851 > ArrayList AllGetters = new ArrayList(); 6864,6881c6865,6868 < < if (ilist == null) { < lookup_type = lookup_type.BaseType; < continue; < } < < found_any = true; < < // < // Step 2: find the proper match < // < if (ilist.getters != null && ilist.getters.Count > 0) { < found_any_getters = true; < get = (MethodInfo) Invocation.OverloadResolve ( < ec, new MethodGroupExpr (ilist.getters, loc), arguments, loc); < < if (get != null) < break; --- > if (ilist != null) { > foreach (object o in ilist.getters) { > AllGetters.Add(o); > } 6883d6869 < 6884a6871,6876 > } > if (AllGetters.Count > 0) { > found_any = true; > found_any_getters = true; > get = (MethodInfo) Invocation.OverloadResolve ( > ec, new MethodGroupExpr (AllGetters, loc), >arguments, loc);
using System; class A { public object this[double x] { get { return 3*x; } } } class B : A { public new object this[double x] { get { return x; } } } class C : B{ public object this[string s] { get { return s; } } public object this[int x] { get { return x; } } } struct EntryPoint { public static void Main (string[] args) { C test = new C(); Console.WriteLine("Double (333.333): "+test[333.333]); Console.WriteLine("String (a string): "+test["a string"]); Console.WriteLine("Integer (111): "+test[111]); } }